/ Published in: JavaScript
Page Book mark using code
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
HTML ---------------------------------------------------------------------------------------------------- <a href="javascript:viod(0);" onclick="addBookmark(); return false;">Book mark</a> JAVA SCRIPT --------------------------------------------------------------- function addBookmark( title, url ) { if (title == undefined) title = document.title; if (url == undefined) url = top.location.href; if (window.sidebar) // firefox window.sidebar.addPanel(title, url, ''); else if(window.opera && window.print) // opera { var elem = document.createElement('a'); elem.setAttribute('href',url); elem.setAttribute('title',title); elem.setAttribute('rel','sidebar'); elem.click(); } else if(document.all) // ie window.external.AddFavorite(url, title); else if (navigator.appName=="Netscape") //Netscape alert( 'To bookmark this site press "Ctrl+D".' ); else alert( 'Your browser doesn\'t support this feature' ); }