View Full Version : Hyperlink that prints page?
hi peeps. I wnet to a site (can't remember where now) and it had a hyperlink "Print this Page". The link opened up the print options window, just before you print you know. It was done using JS i think but i couldn't see it in source. It was something like
open.window(print)
anyway, an ne1 tell me what the actual link is and any ode that it needs pls.
cheers
------------------
Rigo
I don't have any problems clicking on the big button on my browser toolbar that says 'Print'.
yeah but that's not the point!
anyone know the code?
------------------
Rigo
Banana Man
23-05-2000, 19:00
it wouldnt be nething like that, or you could do a
on mousemove = open.window(print)
(well u know what i mean :p)
-CaNdYfLo$$-
24-05-2000, 10:30
alpha m8.... Rigo could be using a window with no nav buttons etc... so then the user can click a print button on his site as well the never buttons aint on the window...
for an example look at a site i designed...
www.slowdeath.co.uk (http://www.slowdeath.co.uk)
when u enter the flash enabled bit u will see a java window pop up with no commands m8....
So alpha m8 this could be a reason why he wants it...
uc?
------------------
<LI>CaNdYfLo$${MAF} (http://run.to/MAF)
<LI>Why not click here (http://www.kpforums.cjb.net/) and visit the new league forums....?
<LI>Want some skins? Well here (http://www.kpskins.co.uk) they are :)
<LI>Want some resourses for flash? (http://www.flashaddict.com)
"YoU hAvE bEeN cAnDeRiSeD!!"
WildWayz
24-05-2000, 15:11
try this
<BLOCKQUOTE><font size="1" face="Verdana">code:</font><HR><pre>
<HTML>
<HEAD>
<SCRIPT LANGUAGE="Javascript"><!--
// a little variable because IE3 isn't nice about testing for objects in vbscript
DA = (document.all) ? 1 : 0
window.onerror=handle_error
function handle_error(){
msg="________________________________\n\n"+
"Please use your Browser\'s Print Button"+
"\n ________________________________\n"
alert(msg)
// to cancel the script error warning
return true;
}
//--></SCRIPT>
<SCRIPT LANGUAGE="VBScript"><!--
sub window_onunload
' Just tidy up when we leave to be sure we aren't
' keeping instances of the web-browser control in memory
on error resume next
set WB = nothing
end sub
sub print
olecmd = 6 ' Print Command
oleparam = 1
on error resume next
WB.ExecWB olecmd, oleparam
if err.number <> 0 then
if DA then ' ie4 - user probably cancelled
alert "Nothing was printed." '& err.number & " : " & err.description
else ' ie3 - give other instructions
handle_error
end if
end if
end sub
//--></SCRIPT>
</HEAD><BODY BGCOLOR="#FFFFFF">
<FORM><INPUT TYPE="button" VALUE="Print" onClick= "window.print();"></FORM>
## the above line is for using with a form buttom or below using with an image ##
<A HREF="javascript:window.print()"><IMG SRC="print.gif" WIDTH="39" HEIGHT="29" BORDER="0"></A>
<OBJECT ID="WB" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>
</BODY></HTML>
[/code]
[RAN#]PAND
24-05-2000, 15:41
oooh looks nasty and complicated!!
------------------
Play Nano-Racing Dag-Nammit (http://www.nano-racing.net)
hey thx v much wildwayz. It works a treat apart from if i cancel the print window another identical window opens but then if I canel that one it loses properly and the message appears.
I couldn't find in the code where the print command is listed twice, but an this be fixed?
thx again m8
------------------
Rigo
WildWayz
24-05-2000, 19:35
Hmmmm
I see what you mean :/
I cannot look at it just now - but look out for loops in it. Also, briefly looking over it, it prints a window then apparently prints another msg box. This may be where it is.
--WildWayz
vBulletin® v3.7.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.