随笔分类 - Javascript
摘要:/*针对表格常用的DOM操作针对<table>元素captiontBodiestFoottHeadrowsdeleteRow(position)insertRow(position)creatCaption()deleteCaption()针对<tbody>元素rowsdeleteCell(position)insertCell(position)针对<tr>元素cellsdeleteCell(position)insertCell(position)*//*添加行(g1)在第i行插入一行insertRow(i); 单元格插入新数据insertCell(i)
阅读全文
摘要:增加监听函数(f1)方法一window.onload = function () { var myP = document.getElementById("myP"); myP.onclick = function () { alert("我被点击了"); }}方法二 添加处理函数attachEvent("onclick", fnClick),删除处理函数detachEvent("onclick", fnClick)var myP;function fnClick() { alert("我被点击了&quo
阅读全文
摘要:getElementById() (e1)function myPhone() { var myItem = document.getElementById("myphone"); alert(myItem.tagName + " " + myItem.childNodes[0].nodeValue);}getElementsByTagName("ul") (e1)function myPhone() { var myItem = document.getElementsByTagName("ul"); alert
阅读全文
浙公网安备 33010602011771号