...

View Full Version : using javascript to print a page...



BigDaddy
01-20-2003, 09:07 PM
I hate frames. Have I mentioned that? I inherited a site in my new job that uses them. While I'm re-writing it using ASP include files, in the meantime I need to be able to support it in frames. The plus side is I'm learning quite a bit of javascript, and how to get around in the frames...


Anway, my question:

My users need to be able toi print all 3 frames, or at least two of them, with it looking like one document. By going thru file-->print, only the active frame is printed. Likewise, by right-clicking on a frame, only that one gets printed, as is the same when I use



javascript:window.print

Anyone got any ideas how to print all of the frames appearing?


Thanks...

Roy Sinclair
01-20-2003, 09:48 PM
javascript: top.print();

BigDaddy
01-20-2003, 10:05 PM
That prints the frame that you put that in, but I'm looking for a way to print all frames that are displayed with one link.

Any ideas?


Thanks.

Roy Sinclair
01-20-2003, 10:10 PM
Originally posted by BigDaddy
That prints the frame that you put that in, but I'm looking for a way to print all frames that are displayed with one link.

Any ideas?


Thanks.

top.print() should print all the frames. top references the "top" window which holds the frameset. window.print() is the reference for printing only the current frame since that references only the local frame's window object.

BigDaddy
01-20-2003, 10:28 PM
It doesn't work. Perhaps it's because I'm using a nested framset, but here is the structure:

<frameset rows='130,450,25' frameborder='no' >
<frame src='TopFrame.asp' name='top_content' >
<frameset cols='22%,*' >
<frame src='navigation.asp' name='nav'>
<frame src='MainFrame.asp' name='content' >
</frameset>")
<frame src=MarqueeList2.asp' name='marquee'>")
</frameset>


I tried putting the link to print in pages in the top_content, nav, and content frames, and only the frame it was in would print. I need to print all 3 at one time with one command, making it look like no frames were used.

I appreciate the help.

justame
01-20-2003, 11:58 PM
Originally posted by BigDaddy
</frameset>")
<frame src=MarqueeList2.asp' name='marquee'>")

/me just a whispers® to big...
ummm howww come you have those bolded parts in the coding???mayyybe thattts whats just a messing® it up??? /me doesnt see where ya just a opened® them...??? aka ("
orrr as just a nother® suggestion...
do you have these 'pages' in like 'doc' form??? you could have just a link® to print this 'page' 'cept it twould be printing just a nother® file made up of the information the viewer is looking @ when they just a click® the 'print' button???

whammy
01-21-2003, 01:41 AM
Good catch, Steph, although I don't *think* that's the problem. But for some reason that looks familiar. ;)

top.print() ? Never tried it because I abhor frames... but as you know, I love messing around with stuff until it works. :D

justame
01-21-2003, 03:48 AM
Originally posted by whammy
Good catch, Steph, although I don't *think* that's the

...as you know, I love messing around with stuff until it works. :D

ya mean it didnt just a belong® there??? hehehe...

n' rotflmao!!! ifin' he wants this to just a work® in netscrap tooo...hehehe...n' rememberin' alll the whaaaaaa's /me sent ya trying to make the ol' db just a netscrap® friendly...:O)))

BigDaddy
01-21-2003, 02:11 PM
Nah, guys. The guy before me had set up the page to check browser version, and had used javascript to write out the framesets using document.write(" "). I deleted that stuff, will probably add it back in, but was troubleshooting it without it. I guess I missed a couple when posting here. :)


Anyway, I tried putting a function in the top page, index, where the framesets are declared. In the function was just a simple javascript:window.print(), which I tried calling from each of the 3 windows. That did nothing but print one frame.


Thankis for all your suggestions, guys. I might have to just tell them to get used to right-clicking and printing until I can roll out a new no-frames site, which is currently in production.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum