PDA

View Full Version : Bookmark Button


Jimmy420
01-24-2008, 01:02 PM
Hi, i'm new to java and need some help. I have the script below and i am trying to make it so when you click on a button it will add the website to your favorites. Could someone give me a hand with this?

function CreateBookmarkLink() {
title = document.title;
url = window.location.href;
if (window.sidebar) { // Mozilla Firefox Bookmark
window.sidebar.addPanel(title, url,"http://www.desperadosofgaming.com/");
} else if( window.external ) { // IE Favorite
window.external.AddFavorite( url, title); }
else if(window.opera && window.print) { // Opera Hotlist
return true; }
}

Thanks,
Jimmy

Philip M
01-24-2008, 05:54 PM
<input type = "button" name = "mybutton" id = "mybutton" value = "Click here to bookmark this page" onclick = "CreateBookmarkLink()">

You should note that Java and Javascript are entirely different programming languages, in spite of the confusingly similar names.

Jimmy420
01-24-2008, 09:48 PM
Thank you! Also didn't know they were different, good tip.
In firefox when i add it to my bookmarks with the button, when i open it up it opens up in a sidebar and not the full window. How can i fix this?

Philip M
01-25-2008, 07:36 AM
I don't use Firefox, but try this (using unescape):-

if (window.sidebar) // firefox
{
window.sidebar.addPanel(unescape(title), unescape(url), "http://www.desperadosofgaming.com/");
}

Jimmy420
01-25-2008, 09:24 AM
Didn't work, nothing happens when i click the button.