只有最后20分了,求一具体表格删减js代码 www.bjcan.com/hengxing/more.asp自己搜索 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 默认为3行,不能再少了,只能增加<form name="form1" method="post" action=""> <input type="button" name="Submit" value="-" onclick="deleteRow()"> <input name="num" type="text" value="3" size="4" maxlength="4"> <input type="button" name="Submit2" value="+" onclick="insertRow()"> <br> <table id="table1" width="500" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="87"><select name="select"></select></td> <td width="277"><input type="text" name="textfield1"></td> <td width="136"><input type="button" name="1" value="1"></td> </tr> <tr> <td><select name="select2"></select></td> <td><input type="text" name="textfield2"></td> <td><input type="button" name="2" value="2"></td> </tr> <tr> <td><select name="select3"></select></td> <td><input type="text" name="textfield3"></td> <td><input type="button" name="3" value="3"></td> </tr> </table></form><script language=javascript> function deleteRow() { var obj=document.getElementById("table1") var rowIndex=obj.childNodes[0].childNodes.length; if(rowIndex>3) { document.getElementById("num").value=document.getElementById("num").value-parseInt(1) obj.deleteRow(rowIndex-parseInt(1)); } } function insertRow() { var obj=document.getElementById("table1") var rowIndex=obj.childNodes[0].childNodes.length; var objTR=obj.insertRow(rowIndex); var objTD1=objTR.insertCell(); var objTD2=objTR.insertCell(); var objTD3=objTR.insertCell(); rowIndex2=parseInt(rowIndex)+parseInt(1) objTD1.innerHTML=obj.childNodes[0].childNodes[rowIndex-1].childNodes[0].innerHTML.replace(/(name=)(\")*(select)(\d)(\2)/gi,"$1$2$3"+rowIndex2+"$5") objTD2.innerHTML=obj.childNodes[0].childNodes[rowIndex-1].childNodes[1].innerHTML.replace(/(name=)(\")*(textfield)(\d)(\2)/gi,"$1$2$3"+rowIndex2+"$5") objTD3.innerHTML=obj.childNodes[0].childNodes[rowIndex-1].childNodes[2].innerHTML.replace(/(=)(\")*(\d)(\2)/gi,"$1$2"+rowIndex2+"$4") document.getElementById("num").value=parseInt(document.getElementById("num").value)+parseInt(1) }</script> 最新版本的jquery.uploadfiy 插件错误,谁用过的帮看看 请问网站上用户首次登录的动画指引效果是怎么实现的? JavaScript 图片上传预览效果 请问如何取消在div上绑定的事件 如何给漂浮的广告加一个关闭按钮,如何写js脚本 如何控制输入的URL地址格式是否有效,只支持http和tcp格式的。 初学JavaScript,以下函数不能理解? 有关document技术问题!!!!! title属性的问题 如何不用disabled而使select不能下拉或不能改变原有的值? 使用new Date()生成一个时间对象的问题! 高手进来
<form name="form1" method="post" action="">
<input type="button" name="Submit" value="-" onclick="deleteRow()">
<input name="num" type="text" value="3" size="4" maxlength="4">
<input type="button" name="Submit2" value="+" onclick="insertRow()">
<br>
<table id="table1" width="500" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="87"><select name="select"></select></td>
<td width="277"><input type="text" name="textfield1"></td>
<td width="136"><input type="button" name="1" value="1"></td>
</tr>
<tr>
<td><select name="select2"></select></td>
<td><input type="text" name="textfield2"></td>
<td><input type="button" name="2" value="2"></td>
</tr>
<tr>
<td><select name="select3"></select></td>
<td><input type="text" name="textfield3"></td>
<td><input type="button" name="3" value="3"></td>
</tr>
</table>
</form>
<script language=javascript>
function deleteRow()
{
var obj=document.getElementById("table1")
var rowIndex=obj.childNodes[0].childNodes.length;
if(rowIndex>3)
{
document.getElementById("num").value=document.getElementById("num").value-parseInt(1)
obj.deleteRow(rowIndex-parseInt(1));
}
}
function insertRow()
{
var obj=document.getElementById("table1")
var rowIndex=obj.childNodes[0].childNodes.length;
var objTR=obj.insertRow(rowIndex);
var objTD1=objTR.insertCell();
var objTD2=objTR.insertCell();
var objTD3=objTR.insertCell();
rowIndex2=parseInt(rowIndex)+parseInt(1)
objTD1.innerHTML=obj.childNodes[0].childNodes[rowIndex-1].childNodes[0].innerHTML.replace(/(name=)(\")*(select)(\d)(\2)/gi,"$1$2$3"+rowIndex2+"$5")
objTD2.innerHTML=obj.childNodes[0].childNodes[rowIndex-1].childNodes[1].innerHTML.replace(/(name=)(\")*(textfield)(\d)(\2)/gi,"$1$2$3"+rowIndex2+"$5")
objTD3.innerHTML=obj.childNodes[0].childNodes[rowIndex-1].childNodes[2].innerHTML.replace(/(=)(\")*(\d)(\2)/gi,"$1$2"+rowIndex2+"$4")
document.getElementById("num").value=parseInt(document.getElementById("num").value)+parseInt(1)
}
</script>