如何让表格中动态增加的行,能在链接到其它页面,后退后,仍然能保持新增加的行?
风斧 2004-11-06 10:22:33 试验了一个table3.htm,能够增加表格的行,table3上的链接到table2也好使,但从table2回到table3时,原来table3中新增的行没有了?
怎么回事?
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JAVASCRIPT">
iIndex = 0;
function showIndex(){
alert(iIndex);
}
function getIndex(){
iIndex = event.srcElement.parentElement.rowIndex;
}
function insertRow(iPos){
var otr=myTable.insertRow(iPos);
var ocell=otr.insertCell(0);
ocell.innerText=""
var ocell=otr.insertCell(1);
ocell.innerText=""
}
function deleteRow(iPos){
document.all.myTable.deleteRow(iPos);
}
</SCRIPT>
</HEAD>
<BODY>
<table id="myTable" border=1>
<tr onclick="getIndex()">
<td>1</td>
<td>2</td>
</tr>
<tr onclick="getIndex()">
<td>1</td>
<td>2</td>
</tr>
</table>
<form>
<input type=button onclick="alert(iIndex)" value="show Index">
<input type=button onclick="insertRow(iIndex)" value="插入行">
<input type=button onclick="deleteRow(iIndex)" value="删除行">
<input type=button onclick="history.go(-1);" value="返回">
</form>
</BODY>
</HTML>