if you really care about index, add a hidden input to your form, get all the remaining indexes and merge them and set the value to the hidden input
解决方案 »
- 一个UBB引用回复的正则表达式
- 如何判断firefox浏览器???用document.all?1:0这样的方法
- 谁能帮我处理一下IE7里的 iframe?
- 这么好的重写系统alert和confirm的程序 竟然不兼容FF 谁来挽救一下它呢?
- IF语句是不是只能判断innerHTML内容的有无,但并不能判断内容是什么?
- 还有如何提取Table中的行数
- 在使用框架的页面情况下把整个框架页面都关闭,并跳到另外一个页面
- javascript能否读写本机文件?
- 表单取值问题,急!
- 关于动态生成div后点击事件无法支持到新div的提问
- 如何将IE窗口标题栏上的"-Microsoft Internet Explorer"去掉?
- 使用window.open("xxx.asp?xxx","_top"....);打开窗口,这个xxx参数如何写?
{
var e = event.srcElement;
var s = "";
for (var i=0; i < table1.rows.length; i++)
{
var att = table1.rows[i].getAttribute("id");
if (att != null)
{
var n = att.indexOf("row");
if (n >=0)
s += "," + att.substring(n+3);
}
} if (s.length > 0)
s = s.substring(1); alert(s); e.form.indexlist.value = s;
}on the server side, you can dos = request.form("indexlist")
a = split(s,",")
for n=0 to ubound(a)
a(n) 'is one of the indices remaining
next
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<SCRIPT language=javascript>
var rowIndex = 0;
function openW(v) {
alert("当前行的index="+v); //怎么能获得当前选中行的index;
}
function addOneLine_onClick() {
var row=table1.insertRow(table1.rows.length);
var col = row.insertCell(0);
col.innerHTML = "<input id=fphm name=fphm size=8 maxlength=5>";
col = row.insertCell(1);
col.innerHTML = "<INPUT maxLength=6 size=10 name=ys><INPUT type=button value =... name=selectys index=\""+ rowIndex +"\" onclick=\"openW(this.index)\">";
col = row.insertCell(2);
col.innerHTML = "<input id=fdjh name=fdjh size=10 maxlength=10>";
col = row.insertCell(3);
col.innerHTML = "<input id=fdjh name=fdjh size=10 maxlength=10>";
col = row.insertCell(4);
col.innerHTML = "<input type='button' value='删除一行' id=btnDeleteLine name=btnDeleteLine onclick=\"return Delete_Row('row" + rowIndex + "')\">";
row.setAttribute("id", "row" + rowIndex);
row.setAttribute("name", "row" + rowIndex);
rowIndex++;
}
function Delete_Row(rowTag){
var i = table1.rows(rowTag).rowIndex;
var j;
for(j=i;j<=rowIndex;j++)
{
table1.rows(j).cells(1).all("selectys").index--;
}
table1.deleteRow(i);
rowIndex--;
alert(rowIndex);
}
</SCRIPT><META content="MSHTML 5.50.4134.600" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff>
<DIV align=center>
<FORM name=form1 action="" method=post>
<TABLE id=table1 height=23 cellSpacing=2 cellPadding=2 width=600 border=0>
<TBODY>
<TR>
<TD width=70 height=18>
<DIV align=left>发票号</DIV></TD>
<TD width=119 height=18>
<DIV align=left>商品车颜色</DIV></TD>
<TD width=89 height=18>
<DIV align=left>发动机号</DIV></TD>
<TD width=93 height=18>
<DIV align=left>底盘号</DIV></TD>
<TD width=76 height=18>
<DIV align=left>删除</DIV></TD></TR></TBODY></TABLE>
<SCRIPT language=javascript>
addOneLine_onClick();
</SCRIPT>
<P><INPUT onclick="return addOneLine_onClick()" type=button value=加入一行 name=btnAddLine>
<INPUT onclick=form_submit() type=button value=保存 name=btnSave> <INPUT onclick=form_reset() type=button value=重置 name=btnReset> </P>
<P> </P>
<P> </P></FORM>
<P> </P></DIV></BODY></HTML>
</html>