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

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
gpig
Forum Newbie
Posts: 15
Joined: Sat Apr 17, 2004 2:52 am

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

Post 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
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

Haven't done serious Javascript in a long while, but have you tried

Code: Select all

document.maincontent.document.print()
gpig
Forum Newbie
Posts: 15
Joined: Sat Apr 17, 2004 2:52 am

Post by gpig »

error: Object doesnt support this property or method

thanx anyhow
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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..
gpig
Forum Newbie
Posts: 15
Joined: Sat Apr 17, 2004 2:52 am

Post by gpig »

Scweeet! Thanx, that exactly what I want
Post Reply