动态表单域做好了,但是不能删除!!help me!!
总是有错,大概是找不到删除节点!那个搞手指点一下!谢谢!
<HTML>
<HEAD>
<TITLE>Advanced Select</TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!--
var cnt=0
function Add()
{
var temp = document.body.children.item(0).rows.item(1).cells.item(0).children.item(0).rows.item(0).cells.item(0).children.item(0).children.item(0)
temp.insertRow(temp.rows.length);
temp.rows.item(temp.rows.length -1).insertCell(0);
var xx=temp.rows.length -1 ;
var sHTML;
sHTML=""
+"<table>"
+" <tr>"
+" <td colspan='3'>("+ cnt++ +")Fild:<select name='select'>"
+" </select>"
+" <select name='select2'>"
+" <option value='=' selected>=</option>"
+" <option value='<>'><></option>"
+" <option value='like'>like</option>"
+" <option value='<='><=</option>"
+" <option value='>='>>=</option>"
+" </select>Value:<input type='text' name='textfield'>"
+" <select name='select3'>"
+" <option value'' selected>NULL</option>"
+" <option value='and'>AND</option>"
+" <option value='or'>OR</option>"
+" </select>"
+" </form>"
+" <td colspan='3'><input type='button' value='删除' onclick='Delete(this);'>"
+" </td>"
+" </tr>"
+"</table>"
temp.rows.item(temp.rows.length-1).cells.item(0).innerHTML=sHTML; temp.rows.item(temp.rows.length-1).cells.item(0).children.item(0).rows.item(4).cells.item(0).children.item(0).text=xx;
}
function Delete(x)
{
var temp=document.body.children.item(0).rows.item(1).cells.item(0).children.item(0).rows.item(0).cells.item(0).children.item(0).children.item(0)
temp.deleteRow(x.text.valueOf())
for (var j=0;j<temp.rows.length;j++) temp.rows.item(j).cells.item(0).children.item(0).rows.item(4).cells.item(0).children.item(0).text=j;
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<table style="border-collapse: collapse" width="100%">
<form name="form1" method="post" >
<tr>
<td align="center"><INPUT TYPE="button" value="添加搜索条件" onclick="Add()"></td>
</tr>
<tr>
<td align="center"> <TABLE align=center border=0 width="100%" height="100%">
<TR>
<TD width="100%" height="350">
<DIV style=" OVERFLOW: auto;BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; BORDER-BOTTOM: 1px solid; WIDTH: 100%; HEIGHT: 100%">
<table>
<tr>
<td> Fild:
<select name="select">
</select> <select name="select2">
<option value="=" selected>=</option>
<option value="<>"><></option>
<option value="like">like</option>
<option value="<="><=</option>
<option value=">=">>=</option>
</select>Value:<input type="text" name="textfield"> <select name="select3">
<option value"" selected>NULL</option>
<option value="and">AND</option>
<option value="or">OR</option>
</select>
</td>
</tr>
</table><TABLE width="100%">
</TABLE>
</DIV>
</TD>
</TR>
</TABLE>
</td>
</tr>
<tr>
<td align="center">
<INPUT TYPE="submit" value=" 提 交 ">
<INPUT TYPE="reset" value=" 清 空 ">
</td>
</tr>
</form>
</table>
</BODY>
</HTML>