Enjoy an ad free experience by logging in. Not a member yet?
Register .
02-17-2007, 12:46 PM
PM User |
#1
Regular Coder
Join Date: Nov 2005
Location: Horsham, West Sussex, UK
Posts: 363
Thanks: 7
Thanked 1 Time in 1 Post
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.
02-17-2007, 01:28 PM
PM User |
#2
Supreme Master coder!
Join Date: Jun 2002
Location: London, England
Posts: 17,103
Thanks: 197
Thanked 2,421 Times in 2,399 Posts
<a href="#" onclick="javascript :window.print()">Click here to print this page</a>
02-17-2007, 01:32 PM
PM User |
#3
Regular Coder
Join Date: Nov 2005
Location: Horsham, West Sussex, UK
Posts: 363
Thanks: 7
Thanked 1 Time in 1 Post
Thank you!
And is there one for an add to favorites?
02-17-2007, 02:02 PM
PM User |
#4
New Coder
Join Date: Oct 2006
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
<a href="javascript :window.external.AddFavorite('http://www.mysite.com', 'My Site name')">add to favorites</a>
02-17-2007, 07:14 PM
PM User |
#5
Regular Coder
Join Date: Nov 2005
Location: Horsham, West Sussex, UK
Posts: 363
Thanks: 7
Thanked 1 Time in 1 Post
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?
02-17-2007, 07:17 PM
PM User |
#6
Supreme Master coder!
Join Date: Dec 2004
Location: In a place far, far away...
Posts: 19,292
Thanks: 2
Thanked 1,044 Times in 1,020 Posts
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! ||||
02-17-2007, 07:29 PM
PM User |
#7
Regular Coder
Join Date: Nov 2005
Location: Horsham, West Sussex, UK
Posts: 363
Thanks: 7
Thanked 1 Time in 1 Post
Ok, thanks!
02-17-2007, 07:46 PM
PM User |
#8
Regular Coder
Join Date: Jan 2006
Posts: 665
Thanks: 1
Thanked 12 Times in 12 Posts
I'd use PHP to substitute the URL and title
02-17-2007, 08:46 PM
PM User |
#9
Regular Coder
Join Date: Nov 2005
Location: Horsham, West Sussex, UK
Posts: 363
Thanks: 7
Thanked 1 Time in 1 Post
Ok, thank you for your help!
02-18-2007, 02:36 AM
PM User |
#10
Master Coder
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,530
Thanks: 0
Thanked 503 Times in 494 Posts
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);
02-18-2007, 03:21 PM
PM User |
#11
Regular Coder
Join Date: Nov 2005
Location: Horsham, West Sussex, UK
Posts: 363
Thanks: 7
Thanked 1 Time in 1 Post
Ok, so will this put in the url and page title...
window.external.AddFavorite(location.href, document.title);
??
02-18-2007, 05:18 PM
PM User |
#12
Supreme Master coder!
Join Date: Jun 2002
Location: London, England
Posts: 17,103
Thanks: 197
Thanked 2,421 Times in 2,399 Posts
Quote:
Originally Posted by
Allsortgroup
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.
02-18-2007, 06:44 PM
PM User |
#13
Regular Coder
Join Date: Nov 2005
Location: Horsham, West Sussex, UK
Posts: 363
Thanks: 7
Thanked 1 Time in 1 Post
Ok thank you!
Jump To Top of Thread
Thread Tools
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
HTML code is Off
All times are GMT +1. The time now is 08:00 PM .
Advertisement
Log in to turn off these ads.