[英]get all innerHTML of a parent window
I'm trying to get all the innerHTML
of my web form, here's what I'm doing:我正在尝试获取我的网络表单的所有
innerHTML
,这是我在做什么:
I need to be able to do this for parent of the window.我需要能够为窗口的父级执行此操作。 So to begin, using var = dialog I get the window.parent as shown below:
所以首先,使用 var = dialog 我得到 window.parent 如下所示:
function PrintForm() {
var dialog = window.parent.wdwBHForm;
}
Now I'm trying to use dialog (parent of window) to get all innerHTML, because my end goal is to be able to print it.现在我正在尝试使用对话框(窗口的父级)来获取所有的innerHTML,因为我的最终目标是能够打印它。
var html = dialog.contentDocument.documentElement.innerHTML
I've tried this line above, but it doesn't work.我已经尝试过上面的这一行,但它不起作用。
I also have infragistics control that I need to get innerHTML
for - I hope I'd be able to do the same.我也有需要获取
innerHTML
设施控制——我希望我也能做到这一点。
Any idea?任何的想法?
May be you can do that in the following way:也许你可以通过以下方式做到这一点:
function PrintForm() { var innerHtml = window.document.documentElement.innerHTML; // If you want to access the parent window // var innerHtml = window.parent.document.documentElement.innerHTML; console.log(innerHtml); }
<form name="myForm" id="myForm"> UserName : <input type="text" name="userName"> </form> <button onclick="PrintForm()">Show InnerHTML</button>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.