试试把函数,都改成这样
deleteRow('mxh',1)
改成
deleteRow('mxh',this.rowIndex)还有,最好不要这么写
document.all[tableID]
用
document.getElementById(tableID)
deleteRow('mxh',1)
改成
deleteRow('mxh',this.rowIndex)还有,最好不要这么写
document.all[tableID]
用
document.getElementById(tableID)
解决方案 »
- 百度新闻js调用问题,高手们能否路见不平下
- 哪位大侠能帮我修改一下代码(鼠标经过div DIV由透明变为不透明),小弟不胜感激
- jquery li的问题
- 页面定位问题.DIV绝对固定问题.谢谢拉
- JS 中使用 PHP变量 使JS文件失效
- 为什么0.2+0.4不等于0.6
- 怎样控制这个语句让探出的窗口出现在右下角? 分辨率为 400x300
- 鼠标单击文本框内容,怎样取得其在文本框中的位置??
- unload对象为何无效,如何知道,客户端已经关闭窗口
- 高分酬谢,JavsScript中的select case语句的详细语法,有例子最好。
- 这个身份验证函数怎么没有用?
- input type="file" 高级问题,超高手来~~~速度结贴~
deleteRow('mxh'',this.parentNode.rowIndex)
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<TITLE>New Document </TITLE>
<script>
function deleteRow(obj){
while(obj){
if(obj.tagName=="TR"){
obj.parentNode.removeChild(obj);
return;
}
obj = obj.parentNode;
}
}
</script>
</HEAD>
<BODY>
<table border=3 id=mxh>
<tr>
<td>第1行</td>
<td width=30><input type=button onclick="deleteRow(this)" value="删除本行"></td>
</tr>
<tr>
<td>第2行</td>
<td><input type=button onclick="deleteRow(this)" value="删除本行"></td>
</tr>
<tr>
<td>第3行</td>
<td><input type=button onclick="deleteRow(this)" value="删除本行"></td>
</tr>
<tr>
<td>第4行</td>
<td><input type=button onclick="deleteRow(this)" value="删除本行"></td>
</tr>
</table>
</BODY>
</HTML>