‘Add to Favourites’ button javascript


Here is a simple code, that i found useful from dynamicdrive. You can use for ‘Add to Favourites’ button in HTML. Add them in your head tag:

<script type=”text/javascript”>

/***********************************************
* Bookmark site script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

function bookmarksite(title, url){
if (document.all)
window.external.AddFavorite(url, title);
else if (window.sidebar)
window.sidebar.addPanel(title, url, “”)
}

</script>

You can then call this javascript in your button ‘onclick’ event like this:

javascript:bookmarksite(‘site_title’, ‘site_URL’)

Demo

  1. I have read so many articles or reviews about the blogger lovers however
    this article is really a nice article, keep it up.

    Reply

Feel free to leave a reply here...

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: