JavaScript 和 window.document 对象。如何更改文档中的值
我有一个正常的页面和弹出窗口。在弹出窗口上,我正在修改 JavaScript,以便回调将更改我的页面(弹出窗口后面的页面)上的值。但我在 javascript 中很难导航回该字段。
我有以下内容:
window.document.getElementById('mynewfield').value = newValue;
但这不是找到字段,需要更改为:
window.ID-OF-MY-WINDOW-BEHIND.document.getElementById('mynewfield').value = newValue;
我怎样才能知道ID是什么? javascript 有 print_r 函数吗?
I have a normal page and popup 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). But I am struggling on navigating back to that field in javascript.
I have the following:
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;
How can I find out what the ID is? Is there a print_r funciton for javascript?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您正在寻找的是:
您可以按如下方式使用它:
I think what you're looking for is:
You can use this as follows: