Using "#" and the onClick

Please note that official support for this menu version has now ceased. There are still plenty of users, though, and the forum is still running. Some of our long-time users may be able to help you out.
Post Reply
jiashen
Beginner
Beginner
Posts: 4
Joined: Mon Jun 09, 2003 7:17 am

Using "#" and the onClick

Post by jiashen »

i have this link on my site that goes <a href="#" onClick="window.external.AddFavorite(window.location,document.title)">Bookmark Page</a>

so now i wanna put this in the menu. how?

(btw i dunno js)
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

To add it to the menu, use the following line.

,"SetBookmark","javascript:window.external.AddFavorite(window.location,document.title) onbordercolor=ff0000;offbordercolor=FFFFFF;",,"StatusBarText",0

Basically in the URL section you are putting a call to the javascript function, instead of using the onClick event handler.

Hope this helps!
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
jiashen
Beginner
Beginner
Posts: 4
Joined: Mon Jun 09, 2003 7:17 am

Post by jiashen »

ah thanks i think i've got it.
rhodos
Beginner
Beginner
Posts: 9
Joined: Wed Nov 05, 2003 7:32 am

Post by rhodos »

Hi,
is there a possibility to add my own entries instead of "window.location" and "document.title"? For example not the current url but the index.html or not the current title but another one.
Thanx for your help
Thomas
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

Sure, I dont see what not. Just enclose those values in single quotes. It would look something like

Code: Select all

,"SetBookmark","javascript:window.external.AddFavorite('page.html','My Great Page') onbordercolor=ff0000;offbordercolor=FFFFFF;",,"StatusBarText",0 
But no single quotes or aposterphies (sp?) inside the names though...ok. If this doesnt work, there is one last thing you can do that will definetly work.
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
rhodos
Beginner
Beginner
Posts: 9
Joined: Wed Nov 05, 2003 7:32 am

Post by rhodos »

it does not !!! Bad luck. Nevertheless many thanks for your help.
ciao
wimn
Beginner
Beginner
Posts: 1
Joined: Thu Nov 13, 2003 2:23 pm

Post by wimn »

It goes wrong on the quotes.

Code: Select all

javascript:window.external.AddFavorite(window.location,document.title)
works fine, but

Code: Select all

javascript:window.external.AddFavorite('page.html','My Great Page')
does not. A workaround might be to call a method, that does the job, like

Code: Select all

javascript:addMyFavorite()
and define the method in your menu definition file, like

Code: Select all

function addMyFavorite() { window.external.AddFavorite('page.html','My Great Page');}
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

I actually thought about that, but I thought that if this person wanted to have this type of thing in a couple different menu items, that would mean defining an entire function just for each menu item. Theres no real dynamic ability there. But if this person only is going to use this once in a page, then its the perfect solution.
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
Post Reply