...

View Full Version : Print this page link?



Andy92
02-17-2007, 12:46 PM
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.

:confused:

Philip M
02-17-2007, 01:28 PM
<a href="#" onclick="javascript:window.print()">Click here to print this page</a>

Andy92
02-17-2007, 01:32 PM
Thank you!

And is there one for an add to favorites?

arturex
02-17-2007, 02:02 PM
<a href="javascript:window.external.AddFavorite('http://www.mysite.com', 'My Site name')">add to favorites</a>

Andy92
02-17-2007, 07:14 PM
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?

_Aerospace_Eng_
02-17-2007, 07:17 PM
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.

Andy92
02-17-2007, 07:29 PM
Ok, thanks! :thumbsup:

croatiankid
02-17-2007, 07:46 PM
I'd use PHP to substitute the URL and title

Andy92
02-17-2007, 08:46 PM
Ok, thank you for your help! :thumbsup:

felgall
02-18-2007, 02:36 AM
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);

Andy92
02-18-2007, 03:21 PM
Ok, so will this put in the url and page title...

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

??

Philip M
02-18-2007, 05:18 PM
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.

Andy92
02-18-2007, 06:44 PM
Ok thank you! :thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum