...

View Full Version : bookmark javascript



dirksmith
07-05-2006, 05:14 PM
Hi

I'm having a problem adapting (and calling) a create book map javascript within a html hot-spot link.

The main script is:

<script language="JavaScript">
<!--
var bookmarkurl="put the url that you want bookmarked here"
var bookmarktitle="put the title that you want for the url here"

function addbookmark(){
if (document.all)
window.external.AddFavorite(bookmarkurl,bookmarktitle)
}
-->
</script>


The script element within the main code is:

<a href="javascript:addbookmark()">bookmark our site</a>



the hot spot link HTML is:

<area shape="rect" coords="439,23,620,45" href="#" target="_self" title="Bookmark This Page" alt="Bookmark This Page" >



Any ideas on how I adapt javascript within the hotspot HTML above?

Thanks

Dirk

felgall
07-05-2006, 09:33 PM
1. Change:

if (document.all)
window.external.AddFavorite(bookmarkurl,bookmarktitle)

to

if (window.external)
window.external.AddFavorite(bookmarkurl,bookmarktitle)

since the code you are trying to run only works on some of the browsers that support document.all

2. replace:

href="javascript:addbookmark()

with

onclick="addBookmark();


You can add that to whatever you want to apply it to including the <area>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum