Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-17-2007, 12:46 PM   PM User | #1
Andy92
Regular Coder

 
Andy92's Avatar
 
Join Date: Nov 2005
Location: Horsham, West Sussex, UK
Posts: 363
Thanks: 7
Thanked 1 Time in 1 Post
Andy92 is an unknown quantity at this point
Print this page link?

Hi there,

What is the javascript that i need to apply to a link, that when a user clicks that link it will print the page that they are on. But not just print it straight away of course, just open up the usual printing options bar liek when you click file print.

__________________
@Andy92 / Dribbble
Andy92 is offline   Reply With Quote
Old 02-17-2007, 01:28 PM   PM User | #2
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,103
Thanks: 197
Thanked 2,421 Times in 2,399 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
<a href="#" onclick="javascript:window.print()">Click here to print this page</a>
Philip M is offline   Reply With Quote
Old 02-17-2007, 01:32 PM   PM User | #3
Andy92
Regular Coder

 
Andy92's Avatar
 
Join Date: Nov 2005
Location: Horsham, West Sussex, UK
Posts: 363
Thanks: 7
Thanked 1 Time in 1 Post
Andy92 is an unknown quantity at this point
Thank you!

And is there one for an add to favorites?
__________________
@Andy92 / Dribbble
Andy92 is offline   Reply With Quote
Old 02-17-2007, 02:02 PM   PM User | #4
arturex
New Coder

 
Join Date: Oct 2006
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
arturex is an unknown quantity at this point
<a href="javascript:window.external.AddFavorite('http://www.mysite.com', 'My Site name')">add to favorites</a>
arturex is offline   Reply With Quote
Old 02-17-2007, 07:14 PM   PM User | #5
Andy92
Regular Coder

 
Andy92's Avatar
 
Join Date: Nov 2005
Location: Horsham, West Sussex, UK
Posts: 363
Thanks: 7
Thanked 1 Time in 1 Post
Andy92 is an unknown quantity at this point
Ok,

Is there any way that it could automatically put the url and page title into the favorite when they click it depending on what page they are on?
__________________
@Andy92 / Dribbble
Andy92 is offline   Reply With Quote
Old 02-17-2007, 07:17 PM   PM User | #6
_Aerospace_Eng_
Supreme Master coder!


 
_Aerospace_Eng_'s Avatar
 
Join Date: Dec 2004
Location: In a place far, far away...
Posts: 19,292
Thanks: 2
Thanked 1,044 Times in 1,020 Posts
_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light
Just combine them. We aren't going to hand feed you everything. You've gotten both scripts you needed now just make them one link. Also this adding to favorites stuff is the noob thing to do. I wouldn't recommend it but hey its your site not mine.
__________________
||||If you are getting paid to do a job, don't ask for help on it!||||
_Aerospace_Eng_ is offline   Reply With Quote
Old 02-17-2007, 07:29 PM   PM User | #7
Andy92
Regular Coder

 
Andy92's Avatar
 
Join Date: Nov 2005
Location: Horsham, West Sussex, UK
Posts: 363
Thanks: 7
Thanked 1 Time in 1 Post
Andy92 is an unknown quantity at this point
Ok, thanks!
__________________
@Andy92 / Dribbble
Andy92 is offline   Reply With Quote
Old 02-17-2007, 07:46 PM   PM User | #8
croatiankid
Regular Coder

 
croatiankid's Avatar
 
Join Date: Jan 2006
Posts: 665
Thanks: 1
Thanked 12 Times in 12 Posts
croatiankid is on a distinguished road
I'd use PHP to substitute the URL and title
__________________
Hrvoje
Croatiankid designs
Downtown host
croatiankid is offline   Reply With Quote
Old 02-17-2007, 08:46 PM   PM User | #9
Andy92
Regular Coder

 
Andy92's Avatar
 
Join Date: Nov 2005
Location: Horsham, West Sussex, UK
Posts: 363
Thanks: 7
Thanked 1 Time in 1 Post
Andy92 is an unknown quantity at this point
Ok, thank you for your help!
__________________
@Andy92 / Dribbble
Andy92 is offline   Reply With Quote
Old 02-18-2007, 02:36 AM   PM User | #10
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,530
Thanks: 0
Thanked 503 Times in 494 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
You don't need PHP to substitute known values, you just need to code the JScript correctly. The statement should ALWAYS be written as:

window.external.AddFavorite(location.href, document.title);
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote
Old 02-18-2007, 03:21 PM   PM User | #11
Andy92
Regular Coder

 
Andy92's Avatar
 
Join Date: Nov 2005
Location: Horsham, West Sussex, UK
Posts: 363
Thanks: 7
Thanked 1 Time in 1 Post
Andy92 is an unknown quantity at this point
Ok, so will this put in the url and page title...

window.external.AddFavorite(location.href, document.title);

??
__________________
@Andy92 / Dribbble
Andy92 is offline   Reply With Quote
Old 02-18-2007, 05:18 PM   PM User | #12
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,103
Thanks: 197
Thanked 2,421 Times in 2,399 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
Quote:
Originally Posted by Allsortgroup View Post
Ok, so will this put in the url and page title...

window.external.AddFavorite(location.href, document.title);

??
Why not try it and see? As AE says, you seem to need hand feeding all the time. Do make some effort to learn and help yourself.
Philip M is offline   Reply With Quote
Old 02-18-2007, 06:44 PM   PM User | #13
Andy92
Regular Coder

 
Andy92's Avatar
 
Join Date: Nov 2005
Location: Horsham, West Sussex, UK
Posts: 363
Thanks: 7
Thanked 1 Time in 1 Post
Andy92 is an unknown quantity at this point
Ok thank you!
__________________
@Andy92 / Dribbble
Andy92 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:00 PM.


Advertisement
Log in to turn off these ads.