如何让表格中动态增加的行,能在链接到其它页面,后退后,仍然能保持新增加的行?

风斧 风斧 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
试验了一个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>
...全文
评论 17
收藏 已收藏
分享
返回顶部
风斧
JavaScript 87,984 成员 224,680 内容