Problem with Image Swap

Problem with Image Swap

Post by Frank Bish » Fri, 25 Feb 2005 23:25:06


I have been trying to do image swaps and my second image does not show
up, it just goes to a blank image on the mouseover. I have Windows XP
SP2 and it prompts me to allow blocked content when the page loads and
then I do allow. But the swap still does not show up, just the first
image. Also, is there a more advanced example that has multiple swap
buttons in a menu (maybe in an array)? Help appreciated. <code>
<head>
<title>Cool Page</title>
<script language="JavaScript">

image01= new Image(200,40)
image01.src="c:\off.gif"
image02= new Image(200,40)
image02.src="c:\on.gif"

</script>
</head>

<body>

<a href="whatever.html"
onmouseover="document.images['example'].src=image02.src"
onmouseout="document.images['example'].src=image01.src">
<img src="c:\off.gif" name="example"> </a>

</body>
<html>
</code>




*** Sent via Developersdex http://www.yqcomputer.com/ ***
Don't just participate in USENET...get rewarded for it!
 
 
 

Problem with Image Swap

Post by McKiraha » Fri, 25 Feb 2005 23:45:08


Are your images really on the drive root -- "c:\off.gif"?

Put them in the same folder as the page and remove "c:\" or
put them in a folder under the page (e.g. "images") abd change "c:\" to
"images/".

 
 
 

Problem with Image Swap

Post by Stephen Ch » Sat, 26 Feb 2005 00:23:33


While that's always a good idea, the problem here is a syntax error.
If a path must contain backslashes, they must be escaped:

image01.src="c:\\off.gif"