I tried this onClick="main.window.print();return false" to target a Iframe "main", but it prints the whole page and not only the frames content.
Any ideas on how I can target it? Otherwise Ill have to have a print button for each page, but done want that.
Thanx in advance
Jacascript: targeting frame for printing
Moderator: General Moderators
-
magicrobotmonkey
- Forum Regular
- Posts: 888
- Joined: Sun Mar 21, 2004 1:09 pm
- Location: Cambridge, MA
before I had window.print() to print everything, then someone told me to change it to main.window.print() to target "main"., but didnt work. In Dreamweaver it seems that I can type anything infront of window.print() and it turns blue?
This window.print() method is built into the browser I think, does someone know if there is some parameter configration I can send it? My printer is busted ,so I cant test it often, only every time I get to someone with a printer.
This window.print() method is built into the browser I think, does someone know if there is some parameter configration I can send it? My printer is busted ,so I cant test it often, only every time I get to someone with a printer.
-
Guilherme Blanco
- Forum Newbie
- Posts: 12
- Joined: Wed Jun 02, 2004 4:58 pm
- Location: São Carlos - SP/Brazil
- Contact:
To be Standards:
If this is a child popup that you want to print the parent:
window.opener.print();
If you are in the parent and want to print the child:
winName.print();
* NOTE: winName = window.open(...);
If you are inside a frame and want to print another one:
top.frames["frameName"].print();
* NOTE: You can use window, but I'm suposing that you have frames, and inside then, you have more nested frames. So, you have to call the top.
If you are calling a JScript function defined in the framed root document (that has the access to all frames in only one level):
document.frames["frameName"].print();
This should help.
Regards,
If this is a child popup that you want to print the parent:
window.opener.print();
If you are in the parent and want to print the child:
winName.print();
* NOTE: winName = window.open(...);
If you are inside a frame and want to print another one:
top.frames["frameName"].print();
* NOTE: You can use window, but I'm suposing that you have frames, and inside then, you have more nested frames. So, you have to call the top.
If you are calling a JScript function defined in the framed root document (that has the access to all frames in only one level):
document.frames["frameName"].print();
This should help.
Regards,
I have an index.html file with an IFRAME called "main" in the page, that IFRAME is inside a table. The print button is in the index.html file, so should I call it like this : main.print(); ? I will rename the frame to something else when I get time to do it all.
Thanx alot for your replies guys,
Ill remember the hierarchy structure for frames like you explained Guilherme, will come in handy in future, thanx.
Thanx alot for your replies guys,
Ill remember the hierarchy structure for frames like you explained Guilherme, will come in handy in future, thanx.