简体   繁体   English

在javascript中使用window.open()时,从php页面获取所有数据并将其发送到另一个页面

[英]Getting all data from php page and send them to another page when using window.open() in javascript

我已经建立了一个网站,并且正在对它进行更改请求,当按下打印图标时,该页面会使用javascript window.open()打开另一个名为print.php的页面,问题是我要在打开时包含要打印的同一页面的print.php页面,将数据输入到输入元素中,并在print.php页面中用这些数据填充它,现在打印页面似乎是空输入,该怎么做?

You can use window.opener to get value from the parent window. 您可以使用window.opener从父窗口获取价值。 so if you have text box in your page having print icon and you want its value in print.php page you can get it like below 因此,如果您的页面中有带有打印图标的文本框,并且您希望在print.php页面中获得它的值,则可以像下面这样获得它

var txtval=window.opener.document.getElementById("txtbx_name").value;

Hope this help :) 希望这个帮助:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM