473,387 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Problem with Image Swap

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
2 1537
"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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Richard | last post by:
Considering the elemtary image swap routine in javascript: document.name.src="filename.gif" How would this be translated into PHP? So that if a visitor has js turned off, clicking on a...
3
by: Randell D. | last post by:
Folks, I'm still learning javascript - I've invested in a couple of books and reading online as much as possible. I'm pretty sure what I am suggesting is possible though I'm trying to weigh up...
1
by: Weston C | last post by:
I'm working on a small javascript application where I'd like to get one behavior when a user clicks on an image (image swap), but when they simply hold down the mouse button for a second, they get...
3
by: John | last post by:
Imagine this: I have a gif-image with text, coloured green. When MouseOver occurs the gif will swap to another gif with red colourded text. On MouseOut the gif turns back to the green text. ...
2
by: Matthew | last post by:
Hi all I'm looking for a solution that can be used in a calendar/gig guide scenario where each day is represented by a dot image. Now this dot must do the following 1. When the mouse goes...
12
by: Charlie King | last post by:
As I understand it, the use of FIR* to replace heading tags with images in visually enabled CSS browsers is now frowned upon on the basis that some screen readers will *nor* read back text that is...
4
by: lemat | last post by:
Hi, I use a radio button form in which users can select a color by clicking on a image. I would like this image to change to another one when it's chosen. (image with a "Chosen" Stamp in the...
11
by: goal2007 | last post by:
I spent hours trying to find an example of onMouseOver and onMouseOut and OnClick. I did find somethings about onMouseOver and onMouseOut but not the onClick. can you please help me with an...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.