Newbie: How to use onMouseOver to change image border?

D

deko

I'm using Dreamweaver MX 2004 - trying to change the border width and color
of an image onMouseOver. The desired behavior is for the image to show a
1px blue border onMouseOver and no border onMouseOut.

Here is html code:

<a href="#top" onMouseOver="MM_changeProp('bac_to_top','','border','1px
solid 0000FF','IMG')"
onMouseOut="MM_changeProp('bac_to_top','','border','border 0px','IMG')"><img
src="images/back_to_top.gif" name="bac_to_top"></a>

Here is Dreamweaver-generated javascript:

function MM_changeProp(objName,x,theProp,theValue) { //v6.0
var obj = MM_findObj(objName);
if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
if (theValue == true || theValue == false)
eval("obj."+theProp+"="+theValue);
else eval("obj."+theProp+"='"+theValue+"'");
}
}

What is happening is nothing. The image just remains as it was with no
border. I am new to javascript... any help is appreciated. Thanks!
 
R

rf

deko
I'm using Dreamweaver MX 2004 - trying to change the border width and color
of an image onMouseOver. The desired behavior is for the image to show a
1px blue border onMouseOver and no border onMouseOut.

You would be better off using CSS for this.

a img {border: solid 1px white;}
a:hover img {border: solid 1px blue;}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top