I'm trying to get all the innerHTML
of my web form, here's what I'm doing:
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:
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.
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.
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>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.