The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> How to I write to and print a hidden iframe?
denmarks
post 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
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 19th March 2024 - 12:43 AM