Add to Favorites script

Status
Not open for further replies.

thewolfe

Posts: 237   +0
Add to Favorites script

I would like to use the following script for "bookmarks" because you can use it with Explorer and Netscape. However, when I just add the script into the body it automatically inserts a "Click here to bookmark this page!" text and puts it at the top of the page.

How do I change the script so that I can hyperlink my text at the location I want to put it. Also, what URL: do I use to link to.

Here's the script.......

http://www.simplythebest.net/scripts/_javascript_100.html

This script opens the "Add to favorites" window in Internet Explorer, but displays a "Remember to bookmark" message in Netscape.

EXAMPLE

// Courtesy of SimplytheBest.net (http://simplythebest.net/info/dhtml_scripts.html) Click here to bookmark this page!

Netscape users should see the message "Remember to bookmark this page! (CTRL-D)".


1) Insert the below script in the <BODY> section where you want the bookmark message to appear on your page

<SCRIPT language="_JavaScript">
// Courtesy of SimplytheBest.net (http://simplythebest.net/info/dhtml_scripts.html)
<!--
if (navigator.appName == 'Microsoft Internet Explorer' &&
parseInt(navigator.appVersion) >= 4)
{
document.write('<font face=\"arial\" size=\"2\"><b><a href=\"#\" onfiltered=\"_javascript:window.external.AddFavorite(location.href,document.title)\">');
document.write('Click here to bookmark this page!</a></font></b>');
}else
{var msg = "Remember to bookmark this page!";
if(navigator.appName == "Netscape") msg += " (CTRL-D)";
document.write(msg);
}
// -->
</SCRIPT>



2) Define the message and the style of the link in this section of the script:

document.write('<font face=\"Arial\" size=\"2\"><b><a href=\"#\" onfiltered=\"_javascript:window.external.AddFavorite(location.href,document.title)\">');
document.write('Click here to bookmark this page!</a></font></b>');
}else
{var msg = "Remember to bookmark this page!";
if(navigator.appName == "Netscape") msg += " (CTRL-D)";
 
Originally posted by thewolfe
Got it from another site. Thanks

care to share, then? if it was important enough to post about its important enough to share the solution...
 
Sure. It was almost to simple. The way the script is set up, all you have to do is insert the text at the exact spot that you want the 'Click here to book mark this page! text to show up.

My dilemma was figuring out where exactly to paste text. But since I had additional text in that area on my page I could figure it out from that.

You can then change that verbiage to whatever you want.

You do not have to hyperlink because it does it for you.

If my explanation is lacking, post again and I'll try it again.
 
Status
Not open for further replies.
Back