Javascript 或 Jquery 在新打开的子窗口中更新 div - 需要语法来更新子窗口 div
我有一个 Ajax 函数,它返回一个 html 字符串作为 vReportContent。
然后我使用 javascript window.open 打开一个新的 html 页面
此页面上有一个名为“divReportContent”的 div,我想使用 vReportContent 更新它
这是 javascript/jquery 代码示例:
var vReportContent = msg; (returned from Jquery Ajax call - this works fine)
var vUrl = 'PrintReport.html';
var vWindowName = 'PrintReport';
window.open('' + vUrl + '', '' + vWindowName + '', width=1010, height=750;
* 更新子项 (打开)窗口 div 与 vReportContent
类似: $('#divReportContent').html(vReportContent);
或者 JavaScript 的等价物。
谢谢!
I have an Ajax function that returns an html string as vReportContent.
Then I open a new html page using javascript window.open
There is a div on this page called 'divReportContent' that I want to update with vReportContent
Here's the javascript/jquery code example:
var vReportContent = msg; (returned from Jquery Ajax call - this works fine)
var vUrl = 'PrintReport.html';
var vWindowName = 'PrintReport';
window.open('' + vUrl + '', '' + vWindowName + '', width=1010, height=750;
* Update the child (opened) window div with vReportContent
something like:
$('#divReportContent').html(vReportContent);
Or a javascript equivalent.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
试试这个。我们必须等到新
window
中的document
加载完毕后才能尝试查找元素。Try this. We have to wait until the
document
inside the newwindow
is loaded before we try to find the element.你可以尝试这样的事情:
You can try something like this: