我有2页
page1.html
<html>
<head>
<script src="sorttable.js"></script>
<script type="text/javascript">
function PrintDiv(id) {
var divToPrint = document.getElementById(id);
var popupWin = window.open("page2.html");
// what here?
popupWin.document.getElementById('div2').appendChild(divToPrint);
popupWin.document.getElementById(id + '_t').style.display = "block";
popupWin.document.getElementById(id + '_t').setAttribute("class","sortable");
}
</script>
</head>
<body >
<div id="divToPrint" >
<table class = "sortable" id="divToPrint_t" style="display:none;">
<tr>
<th>Edificio</th>
<th>Tipo</th>
</tr>
<tr>
<td>E1</td>
<td>T1</td>
</tr>
<tr>
<td>A1</td>
<td>Q1</td>
</tr>
</table>
</div>
<div>
<input type="button" value="print" onclick="PrintDiv('divToPrint');" />
</div>
</body>
</html>
page2.html
<html>
<head>
<script src="sorttable.js"> </script>
</head>
<body>
<div id="div2">
</div>
</body>
</html>
我需要的是,当我按下按钮时,使用page2.html打开新选项卡,使用显示块打开DIV div2中的表格,并保持类可排序以进行排序。
怎么办?
答案 0 :(得分:0)
我很确定你必须使用Ajax来做你想做的事情