How to I write to and print a hidden iframe? |
How to I write to and print a hidden iframe? |
denmarks |
Aug 24 2013, 02:10 PM
Post
#1
|
Advanced Member Group: Members Posts: 207 Joined: 17-January 08 Member No.: 4,734 |
Following is some code I found and slightly modified.
The ID of the hidden iFrame is "hiddenFrame". There is a formatted page of data in "codeList". I want to click a link and run the script that will print "codeList". What would follow this to print the iFrame? ifrm.document.print(); does not work. CODE var ifrm = document.getElementById('hiddenFrame'); ifrm = (ifrm.contentWindow) ? ifrm.contentWindow : (ifrm.contentDocument.document) ? ifrm.contentDocument.document : ifrm.contentDocument; ifrm.document.open(); ifrm.document.write(codeList); ifrm.document.close(); I found the problem. I needed "name=" in addition to "ID=" in the iFrame. This post has been edited by denmarks: Aug 24 2013, 02:47 PM |
Lo-Fi Version | Time is now: 19th March 2024 - 12:43 AM |