Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

glow button?

Status
Not open for further replies.

darkprince

Programmer
Jun 4, 2002
165
AU
hello

I have seen on many websites where there is a dark picture but when the mouse is held over it the picture lights up, how would I go about creating the same effect?

thx in advance

ciao
 
Hi,

You create 2 pictures and have on picture shown when the mouseis not over and then call a different picture when the mouse is over.

Use this code:
<SCRIPT LANGUAGE=&quot;JAVASCRIPT&quot;>
img1on = new Image(); // Active images
img1on.src = &quot;imagemouseover.gif&quot;;

img1off = new Image(); // Inactive images
img1off.src = &quot;imagemouseout.gif&quot;;

function imgOn(imgName) {
if (document.images) {
document
.src = eval(imgName + &quot;on.src&quot;);
}
}


function imgOff(imgName) {
if (document.images) {
document
.src = eval(imgName + &quot;off.src&quot;);
}
}

</SCRIPT>


The pictures above are preloaded, if you want more pictures then follow the same pattern. The next image would just be that code with the number 2 in place of the number 1 and so on.

Then use this as your link:
<A HREF=&quot;file.html&quot; onMouseOver = &quot;imgOn('img1')&quot;onMouseOut = &quot;imgOff('img1')&quot;><IMG NAME=&quot;img1&quot; SRC=&quot;imagemouseout.gif&quot;></A>

Hope this helps! NATE
spyderix.gif

design@spyderix-designz.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top