[英]Javascript and the window.document object. How to change value in document
I have a normal page and popup window.我有一个正常的页面并弹出 window。 On the popup window, I am modifying the javascript so the callback will change the value on my page (the page behind the popup window).
在弹出窗口 window 上,我正在修改 javascript,因此回调将更改我的页面(弹出窗口后面的页面)上的值。 But I am struggling on navigating back to that field in javascript.
但我正在努力回到 javascript 中的那个领域。
I have the following:我有以下内容:
window.document.getElementById('mynewfield').value = newValue; window.document.getElementById('mynewfield').value = newValue;
But this is not finding the field and needs to be changed to:但这并没有找到该字段,需要更改为:
window.ID-OF-MY-WINDOW-BEHIND.document.getElementById('mynewfield').value = newValue; window.ID-OF-MY-WINDOW-BEHIND.document.getElementById('mynewfield').value = newValue;
How can I find out what the ID is?我怎样才能知道身份证是什么? Is there a print_r funciton for javascript?
javascript 是否有 print_r 功能?
I think what you're looking for is:我认为您正在寻找的是:
window.opener
You can use this as follows:您可以按如下方式使用它:
window.opener.document.getElementById('mynewfield').value = newValue;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.