在父页面有一个table,table中有很多行信息,点击其中一行可以弹出一个页面显示其详细信息。然后在弹出页面有一个查看下一条的button,点击之后可以查看到table中的下一条数据详情。
------解决方案--------------------
1.html
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="Generator" content="EditPlus?">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<title>Document</title>
</head>
<body>
<table id=table>
<tr><td>1111</td><td><input type="button" value="show" onclick="pop(this)"/></td></tr>
<tr><td>2222</td><td><input type="button" value="show" onclick="pop(this)"/></td></tr>
<tr><td>3333</td><td><input type="button" value="show" onclick="pop(this)"/></td></tr
<tr><td>4444</td><td><input type="button" value="show" onclick="pop(this)"/></td></tr
<tr><td>5555</td><td><input type="button" value="show" onclick="pop(this)"/></td></tr
<tr><td>6666</td><td><input type="button" value="show" onclick="pop(this)"/></td></tr
</table>
</body>
<script>
function pop(btn){
var obj = {parent:window,
tr:btn.parentNode.parentNode,//tr
table:document.getElementById("table")
}
window.showModalDialog('2.html',obj);
}
</script>
</html>
2.html
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="Generator" content="EditPlus?">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<title>Document</title>
</head>
<body>
<label id='lbl'></label>
<input type=button value="next" onclick="next()"/>
</body>
<script>
var lbl = document.getElementById('lbl'),
wParent = window.dialogArguments.parent,
table = window.dialogArguments.table
tr = window.dialogArguments.tr;
lbl.innerHTML = tr.childNodes[0].innerHTML;
function next(){
tr = table.rows[tr.rowIndex + 1];
lbl.innerHTML = tr.childNodes[0].innerHTML;
}
</script>
</html>