By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,947 Members | 1,505 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,947 IT Pros & Developers. It's quick & easy.

Problem with Image Swap

P: n/a
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.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Frank Bishop" <fb*****@viper.com> wrote in message
news:42**********@127.0.0.1...
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>


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/".
Jul 23 '05 #2

P: n/a
McKirahan <Ne**@McKirahan.com> wrote in message
news:FN********************@comcast.com...
"Frank Bishop" <fb*****@viper.com> wrote in message
news:42**********@127.0.0.1...
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>


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/".

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"

--
S.C.

Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.