日期:2014-05-16  浏览次数:20404 次

如何将一个table的内容传递到另一个页面
在一个php页面中有个table,可以复选多行,选定后点击确定按钮弹出新的页面,新php页面中显示选中的数据,请教如何实现

使用php+js方式

------解决方案--------------------
1,可以在打开窗口时通过查询字符串(如 new.php?id=1&type=g )来传递,
在new.php 用类似 request.querystring("id") 这种方式接收

2,可以在打开新窗口的时候,用form,post提交,
如<form action="new.php" method="post" >
<input name="id" >
<input name="type">
<input type=submit>
</form>
在新窗口,用类似 request.form("id") 这种方式来接收,
这种好处是可以传送大量数据

3,如果是原页面和新页面是同域,两页面可以直接相互访问DOM

如1.htm 源文件
HTML code

 <table id="table1">
 <tr>
 <td> hello</td><td><input type="checkbox" /></td>
 </tr>
 <tr>
 <td> world</td><td><input type="checkbox" /></td>
 </tr>
 <tr>
 <td> mydear</td><td><input type="checkbox" /></td>
 </tr>
 </table>
 
 
 <input type="button" value="open new window" onclick="window.open('2.htm','','width=400,height=300,status=yes')" />