Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

printing another page on my website 1

Status
Not open for further replies.

geniedon

Programmer
Dec 24, 2003
11
GB
hi all,
i wanted know how i can print a page on my website from a image button existing on another page on the same website, what do i do ?, would i have to manipulate either of these codes:
<a href=&quot;javascript:window.print()&quot;><img src=&quot;print.gif&quot;></a>

or

<a href=&quot;form.htm&quot; onClick=&quot;window.print();return false&quot;><img src=&quot;print.gif&quot;></a>

or am i totally going the wrong way about this, any help would be useful.

thanks have merry christmass
 
As far as I know, you can only print a page that is currently loaded - i.e. you cannot print an abitrary page on your website from any other page.

If both pages are loaded in a frameset, for example, then it isn't a problem to call the window.print() method of the frame you want printed...

Basically, the document you need to print must be loaded at the time you want to print it.

Hope this helps!

Dan
 
geniedon,

I have seen this done using style media, but I can't find
the thread with the syntax.

Maybe someone else can help out with the exact syntax.

2b||!2b
 
OK found it,

<link rel=alternate media=print href=&quot;Print.htm&quot;>

Take a look at this whole thread to get a better picture:

thread216-698990

2b||!2b
 
geniedon,
thanks Lrnmore for that , i'll give it a try and let ya know the results.

big up
geniedon
 
hi Lrnmore,
how can i enclose this
<link rel=alternate media=print href=&quot;Print.htm&quot;>
on a button, so the user can press this button to print &quot;Print.htm&quot; page, and by the way what is style media ?, is it related to style sheets.


peace
geniedon
 
You can forget the &quot;style&quot; that was just what I thought was
used to accomplish the task but this method doesn't involve
style, the &quot;media&quot; really does the work.

Here's an example of a button that from the loaded page
will print &quot;test2.html&quot;..

Thanks for the vote! You let us know if you have any more
questions..

Code:
<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;>
<html><head><title>TEST</title>
<link rel=alternate media=print href=&quot;test2.html&quot;>
</head><body>
<input type=&quot;button&quot; value=&quot;Print&quot; onClick=&quot;window.print()&quot;>
</body></html>

Great Javascript Resource:
 
hi Lrnmore,

thanks for that m8, everythings working your a star, if i got anymore questions i know who i'm coming too.

cya
geniedon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top