Forum Moderators: open

Message Too Old, No Replies

Bookmark This Page Script

Can you use a rollover image?

         

sem4u

1:39 pm on Mar 20, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I am trying to use some Javascript so that users can click on am image to bookmark a page. The script is below and does work, but I really need to add in a rollover image. Is this actually possible?


// message to show in non-IE browsers
var txt = "<img src='http://www.domain.com/foo.gif' border='0' width='68' height='70'>"

// url you wish to have bookmarked
var url = "http://www.domain.com";

// caption to appear with bookmark
var who = "Foo Widget Caption"

// do not edit below this line
// ===========================

var ver = navigator.appName
var num = parseInt(navigator.appVersion)
if ((ver == "Microsoft Internet Explorer")&&(num >= 4)) {
document.write('<A HREF="javascript:window.external.AddFavorite(url,who);" ');
document.write('onMouseOver=" window.status=')
document.write("txt; return true ")
document.write('"onMouseOut=" window.status=')
document.write("' '; return true ")
document.write('">'+ txt + '</a>')
}else{
txt += " (Ctrl+D)"
document.write(txt)
}

tedster

5:24 pm on Mar 20, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This certainly is do-able. Have you tried something and found a problem? If so, you can post your code and we'll try to help you debug.

You can find good information about rollover essentials in this thread: Bare-Bones Rollover [webmasterworld.com].

sem4u

9:42 am on Mar 21, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I tried to add this line of code for the mouseover so that I could try and use the NAME function to come up in the 'var txt section':

<a href="index.htm" onMouseOver="bookmark.src"='/Assets/Images/foo_over.gif'" onMouseOut="bookmark.src"='Assets/Images/foo_up.gif'">

var txt = "<img src="Assets/Images/foo_up.gif" name="bookmark" border='0' width='68' height='70'>"

This hasn't worked.

Any help would be much appreciated. This must be possible but I don't know where the mouseover code needs to go in realtion to the bookmark script.