Solved

Image change onmouse over

Posted on 2009-04-05
2
313 Views
Last Modified: 2012-05-06
I'm using attached code to change the image when mouse point over the image.

The problem is, when mouse is over the image, it downloads the image from server, and then change. I mean it takes a bit of time to change.

Is it possible both image will load when page the page gets loaded. and it will change image immediately when mouse over the image.
<img src="img-0.GIF" onmouseover="this.src='img-1.GIF';" onmouseout="this.src='img-0.GIF';">

Open in new window

0
Comment
Question by:marchent
2 Comments
 
LVL 39

Accepted Solution

by:
Roger Baklund earned 500 total points
ID: 24072128
Yes, you can preload the image with javascript, for instance:

img = new Image();
img.src = "img-1.GIF";
0
 
LVL 13

Author Closing Comment

by:marchent
ID: 31566791
sounds nice to me.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to use embargo Date/time in php 29 39
HTML5 frame 5 26
Optimize simple Javascript code to use no repetitions 12 33
Make Session back to empty 9 18
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question