|
|
Creating Add to Favorites link and script in JavaScriptDo you see an "Add to Favorites" lin on the right of this page? When you click on this link, the "Favorites" window pop-ups asking if you would like to add the site to the list. Let us first see the advantages of adding such a link: Here we use a little JavaScript and tie it up to the HREF tag of the link and here is the JavaScript function code:
function addfav()
{
if (document.all)
{
window.external.AddFavorite
("http://www.webdevelopersnotes.com","WebDevelopersNotes")
}
}
Note: The javascript statement "window.external.AddFavorite(..." should be a single line The part in red color in the above code is the URL and the blue is the Name you want to give to the link. The function can be placed inside the document head or an external .js file and will be called from the link as: <A HREF="javascript:addfav()">Add To Favorites</A> This creates a link like - Add To Favorites
Page contents: Creating Add to Favorites function using JavaScript code that helps visitors add your site quickly to their Favorites folder.
Page URL: http://www.webdevelopersnotes.com/tips/html/ creating_add_to_favorites_link_script.php3
|
|