navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

 

javascript:print

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> General Web Development >> javascript:print
Page: [1]
 
Josh22in03

 

Posts: 94
Joined: 4/8/2003
From: York PA
Status: offline

 
javascript:print - 5/5/2003 14:25:55   
Does anybody know the javascript code for making a line of text link to print the document? I cant think of it off the top of my head. I think its javascript:print() or something like that. Thanks!!!

_____________________________

Josh Bergman
http://www.joshspage.com
http://www.yorkwire.com
Gil

 

Posts: 7533
From: North Carolina, USA
Status: offline

 
RE: javascript:print - 5/5/2003 14:56:15   
There' s a few:) ways - here' s a simple one:

<!--

var message = " Print this Page" ;

function printpage() {
window.print();
}

document.write(" <form><input type=button "
+" value=\" " +message+" \" onClick=\" printpage()\" ></form>" );

//-->
</script>


_____________________________

Gil Harvey, 1947-2004

(in reply to Josh22in03)
Josh22in03

 

Posts: 94
Joined: 4/8/2003
From: York PA
Status: offline

 
RE: javascript:print - 5/5/2003 14:57:58   
and put that were in the document? right next to the link??

thanks

_____________________________

Josh Bergman
http://www.joshspage.com
http://www.yorkwire.com

(in reply to Josh22in03)
Gil

 

Posts: 7533
From: North Carolina, USA
Status: offline

 
RE: javascript:print - 5/5/2003 15:10:55   
quote:

and put that were in the document?
Put it where you want the button. What link? That includes a Print this Page button

_____________________________

Gil Harvey, 1947-2004

(in reply to Josh22in03)
pageoneresults

 

Posts: 1001
From: Orange, CA USA
Status: offline

 
RE: javascript:print - 5/5/2003 22:56:38   
And here is a little shorter version that may be a little easier to work with...

<a title=" Print this page" href=" #" onClick=" window.print()" >Print this page</a>

_____________________________

SEO Consultants Directory
Find Search Engine Marketing Companies

(in reply to Josh22in03)
Josh22in03

 

Posts: 94
Joined: 4/8/2003
From: York PA
Status: offline

 
RE: javascript:print - 5/6/2003 9:50:09   
now if I usw that method, can I have it link to a little printer icon instead of the text?

quote:

<a title=" Print this page" href=" #" onClick=" window.print()" >Print this page</a>


I am asuming that insread of the text Print this page, I can put <img src=" print.ico> and then the text or something like that

Thanks again

< Message edited by josh22in03 -- 5/6/2003 9:53 AM >


_____________________________

Josh Bergman
http://www.joshspage.com
http://www.yorkwire.com

(in reply to Josh22in03)
abbeyvet

 

Posts: 5095
From: Kilkenny Ireland
Status: offline

 
RE: javascript:print - 5/6/2003 10:05:53   
Correct - just put the image in instead of or as well as the text.

There is a page with lots of thses short snippets of JavaScript here:

http://www.outfront.net/tutorials_02/adv_tech/js_snippets.htm#print

_____________________________

Katherine

:: InKK Design :: InKK Domains

(in reply to Josh22in03)
Josh22in03

 

Posts: 94
Joined: 4/8/2003
From: York PA
Status: offline

 
RE: javascript:print - 5/6/2003 10:07:57   
Cool. Thanks. Ill have to check out that site!

_____________________________

Josh Bergman
http://www.joshspage.com
http://www.yorkwire.com

(in reply to Josh22in03)
Josh22in03

 

Posts: 94
Joined: 4/8/2003
From: York PA
Status: offline

 
RE: javascript:print - 5/6/2003 10:40:39   
Ok so I have this code

quote:

a title=" Print this page" href=" #" onClick=" window.print()" >Print this page</a>


Now if I want to add a picture to this would I make it look like this:

<a title=" Print this page" href=" #" onClick=" window.print()" ><img src=" images/print.gif" >Print this page<a/> ??

I tried this way, and it messed up the whole page. Thanks again.

_____________________________

Josh Bergman
http://www.joshspage.com
http://www.yorkwire.com

(in reply to Josh22in03)
Gil

 

Posts: 7533
From: North Carolina, USA
Status: offline

 
RE: javascript:print - 5/6/2003 10:58:07   
What do you mean by " it messed up the whole page" ?

I wouldn' t think you' d need both the text link and a graphic link?

Why not: <a title=" Print this page" href=" #" onClick=" window.print()" ><img src=" images/print.gif" ><a/>

_____________________________

Gil Harvey, 1947-2004

(in reply to Josh22in03)
Josh22in03

 

Posts: 94
Joined: 4/8/2003
From: York PA
Status: offline

 
RE: javascript:print - 5/6/2003 11:31:58   
quote:

What do you mean by " it messed up the whole page" ?


What I mean is it threw the text and allingment off on the top of the page.

quote:

<a title=" Print this page" href=" #" onClick=" window.print()" ><img src=" images/print.gif" ><a/>


That is the code I put in and the pcture didn' t show up!

_____________________________

Josh Bergman
http://www.joshspage.com
http://www.yorkwire.com

(in reply to Josh22in03)
abbeyvet

 

Posts: 5095
From: Kilkenny Ireland
Status: offline

 
RE: javascript:print - 5/6/2003 11:36:31   
Do you have a directory called images in the same directory as that page?

Is there an image called print.gif in that directory?

If the path is correct there is no reason for that not to work.

A URL would probably help at this stage.


Oops- just noticed something!

quote:

<a title=" Print this page" href=" #" onClick=" window.print()" ><img src=" images/print.gif" >Print this page<a/>


I think <a/> should be </a> :)

< Message edited by abbeyvet -- 5/6/2003 11:38 AM >


_____________________________

Katherine

:: InKK Design :: InKK Domains

(in reply to Josh22in03)
Josh22in03

 

Posts: 94
Joined: 4/8/2003
From: York PA
Status: offline

 
RE: javascript:print - 5/6/2003 11:38:42   
Yeah the print.gif was in the images directory and I got the horrible red x of death. I took the image out of the images folder and just put it into the root web. Same thing. I dont have a url right now. Its not published. But let me see what I can do.

thanks

As for your <a/> instead of </a> that was correct. THe print feature worked. Just not the image



< Message edited by josh22in03 -- 5/6/2003 11:46 AM >


_____________________________

Josh Bergman
http://www.joshspage.com
http://www.yorkwire.com

(in reply to Josh22in03)
Josh22in03

 

Posts: 94
Joined: 4/8/2003
From: York PA
Status: offline

 
RE: javascript:print - 5/6/2003 11:50:07   
Ok I think I got it. I just found the picture and inserted it into FP and here was the link

<img border=" 0" src=" file://Ywire-server/public/Josh/Sites/myweb/print.gif" width=" 22" height=" 20" >

thats what I needed for it to show up..

_____________________________

Josh Bergman
http://www.joshspage.com
http://www.yorkwire.com

(in reply to Josh22in03)
Page:   [1]

All Forums >> Web Development >> General Web Development >> javascript:print
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts