资源预览内容
第1页 / 共7页
第2页 / 共7页
第3页 / 共7页
第4页 / 共7页
第5页 / 共7页
第6页 / 共7页
第7页 / 共7页
亲,该文档总共7页全部预览完了,如果喜欢就下载吧!
资源描述
基于javascript实现表格的简单操作这篇文章主要为大家详细介绍了基于javascript实现表格的简单操作,具有一定的参考价值,感兴趣的朋友可以参考一下本文实例为大家分享了js表格操作的简单方法,供大家参考,具体内容如下代码如下: zzzz * margin: 0; padding: 0; body width: 1000px; margin: 100px auto; font-family: 微软雅黑; font-size: 18px; background-color: #fff; #table tr text-align: center; tbody tr:nth-child(2n+1) background-color: #ccc; tbody tr:hover background-color: green; inputtype=text height: 25px; width: 136px; background-color: turquoise; margin-bottom: 10px; window.onload=function var otb=document.getElementById(table); var otr=otb.tBodies0.rows; var oadd=document.getElementById(add); var oname=document.getElementById(name); var osex=document.getElementById(sex); var id=otr.length+1; oadd.onclick=function var atr=document.createElement(tr); var atd1=document.createElement(td); var atd2=document.createElement(td); var atd3=document.createElement(td); var atd4=document.createElement(td); atd4.innerHTML=删除; atd1.innerHTML=id+; atd2.innerHTML=oname.value; atd3.innerHTML=osex.value; atr.appendChild(atd1); atr.appendChild(atd2); atr.appendChild(atd3); atr.appendChild(atd4) otb.tBodies0.appendChild(atr); atd4.getElementsByTagName(a)0.onclick=function otb.tBodies0.removeChild(this.parentNode.parentNode) var obtn=document.getElementById(btn); var otxt=document.getElementById(ss); obtn.onclick=function for(var i=0;i var osta=otb.tBodies0.rowsi.cells1.innerHTML.toLowerCase ; var ot=otxt.value.toLowerCase ; var oar=ot.split( ); otb.tBodies0.rowsi.style.background=; for(var j=0;j if(osta.search(oarj)!=-1) otb.tBodies0.rowsi.style.background=red; 姓名: 性别: 序号 人名 性别 修改 1 张三 男 删除 2 李四 男 删除 3 Caesar 女 删除 4 刘言 女 删除 以上就是本文的全部内容,希望对大家的学习有所帮助。
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号