Page 1 of 1

Solution to make printer-friendly print of IFrame's content

Posted: Tue Jun 08, 2004 3:28 am
by gpig
For some reason I cant target my IFrame called "maincontent". I tried maincontent.print(), but it still prints the whole index page.

Is there an easy way to "capture" the page address in the IFrame called "maincontent", and then open a new page with only that page to make it easy to print?

Thanx in advance

Posted: Tue Jun 08, 2004 3:49 am
by patrikG
Haven't done serious Javascript in a long while, but have you tried

Code: Select all

document.maincontent.document.print()

Posted: Tue Jun 08, 2004 3:56 am
by gpig
error: Object doesnt support this property or method

thanx anyhow

Posted: Tue Jun 08, 2004 6:44 am
by feyd
to "capture" the page:

Code: Select all

window.document.maincontent.document.location.href
I'm betting you can figure out how to open a new window from there to call print on..

Posted: Tue Jun 08, 2004 12:05 pm
by gpig
Scweeet! Thanx, that exactly what I want