Import Javascript effect into html body

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I have an effect of changing images in javascript. When mouse over
image1, it changes to image2.
But I don't know how to import the above javascript effect in the body
of html, so that I can design the html page. There is no function of
<body onmouseover="function();...>. Could anyone suggest me any ideas
to solve it? Thanks a lot.

onMouseOver="handlePress();return true;"
onMouseUp="handleRelease();return true;"
if (document.images) {
 img_on =new Image();  img_on.src ="image/1.gif";
 img_off=new Image();  img_off.src="image/2.gif";

function handlePress() {
 if (document.images) document.imgName.src=img_on.src;

function handleRelease() {
 if (document.images) document.imgName.src=img_off.src;

Re: Import Javascript effect into html body


Quoted text here. Click to load it

Do you want it to change back to image1 when you mouseout?  If so, you
could use just css.

Quoted text here. Click to load it

Your javascript examples were very old and outdated.  Best check with the
newsgroup "comp.lang.javascript" for advice.  What you want to do is
actually pretty simple but you need to know something about the current

Infinity has its limits.

Site Timeline