
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、如何用html5操作websql数据库html代码:列车时刻表查询列车时刻表查询请给我留言姓名:留言:留言查询保藏给我留言close保藏胜利,暂且不做处理!.请点击右上角有个关闭按钮提醒:你也可以点击弹窗的外部区域来关闭弹窗。js代码:/*html5操作本地websql数据库*作者:汪政*时光:2017/08/2615:03:19*/vardatatable=null;vardb=opendatabase("mydata","","mydatabase",1024*100);/初始化函数
2、办法functioninit()datatable=document.getelementbyid("datatable");showalldata();/首先移除污七八糟的东西functionremovealldata()for(vari=datatable.childnodes.length-1;i>=0;i-)datatable.removechild(datatable.childnodesi);vartr=document.createelement("tr");varth1=document.create
3、element("th");varth2=document.createelement("th");varth3=document.createelement("th");th1.innerhtml="姓名"th2.innerhtml="留言"th3.innerhtml="时光"tr.appendchild(th1);tr.appendchild(th2);tr.appendchi
4、ld(th3);datatable.appendchild(tr);/显示websql中的数据functionshowdata(row)vartr=document.createelement("tr");vartd1=document.createelement("td");td1.innerhtml=;vartd2=document.createelement("td");td2.innerhtml=row.message;vartd3=document.create
5、element("td");vart=newdate();t.settime(row.time);td3.innerhtml=t.tolocaledatestring()+""+t.tolocaletimestring();tr.appendchild(td1);tr.appendchild(td2);tr.appendchild(td3);datatable.appendchild(tr);/显示全部的数据functionshowalldata()db.transaction(function(tx)tx.execute
6、sql("createtableifnotexistsmsgdata(nametext,messagetext,timeinteger)",);tx.executesql("select*frommsgdata",function(tx,rs)removealldata();for(vari=0;i<rs.rows.length;i+)showdata(rs.rows.item(i)/添加数据functionadddata(name,message,time)db.transaction(function(tx)tx
7、.executesql("insertintomsgdatavalues(?,?,?)",name,message,time,function(tx,rs)alert("留言胜利!");,function(tx,error)alert(error.source+":"+error.message);)/调用functionsavedata()varname=document.getelementbyid("name").value;varmemo=document.getelementbyid("memo").value;vartime=newdate().gettime();adddata(nam
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025智能办公综合体租赁合同
- 2025年铝制品加工合同模板
- 《2025年度土地租赁开发合同》
- 2025房产买卖合同内容
- 2025年度网站建设和运营维护合同示例
- 2025企业设备抵押借款合同范本
- 2025苏州合同范本下载
- 2025药店租赁合同模板(简化版)
- 《2025某绿色生态园景观维护合同》
- 2025建筑材料买卖合同
- 一例盆腔脏器脱垂全盆底重建术患者的护理
- 锁边机安全操作规程
- 特种设备日管控、周排查、月调度模板
- 10kV电力电缆(铜芯)技术规范书
- 高空作业车专项施工方案全套资料
- YY/T 0314-2021一次性使用人体静脉血样采集容器
- 2022年江苏凤凰出版传媒集团有限公司招聘笔试题库及答案解析
- 年产11万吨聚丙烯合成工艺设计
- 幼儿园教学课件《神奇的色彩女王 》课件
- 信息不对称论文
- 话剧《林黛玉进贾府》
评论
0/150
提交评论