Back To Start Of Archive
Taken From The Forum: Archived Topics for the old Version 3.0 JavaScript Menu
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:28
Using "#" and the onClick
Poster: jiashen
Dated: Monday June 9 2003 - 7:26:27 BST
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)
Poster: Hergio
Dated: Monday June 9 2003 - 13:56:43 BST
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!
Poster: rhodos
Dated: Thursday November 6 2003 - 6:58:50 GMT
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
Poster: Hergio
Dated: Friday November 7 2003 - 2:36:59 GMT
Sure, I dont see what not. Just enclose those values in single quotes. It would look something like
Code:
,"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.
Poster: rhodos
Dated: Friday November 7 2003 - 9:35:09 GMT
it does not !!! Bad luck. Nevertheless many thanks for your help.
ciao
Poster: wimn
Dated: Thursday November 13 2003 - 13:34:57 GMT
It goes wrong on the quotes.
Code:
javascript:window.external.AddFavorite(window.location,document.title)
works fine, but Code:
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:
javascript:addMyFavorite()
and define the method in your menu definition file, like Code:
function addMyFavorite() { window.external.AddFavorite('page.html','My Great Page');}
Poster: Hergio
Dated: Saturday November 15 2003 - 15:27:53 GMT
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.