Wednesday, November 24, 2010

How do I make a link change to a different picture when hovered over?

my links on my site are not text, they are pictures. is there a way to make the pictures change to a different one by hovering over? thanks



if you want to see, its the %26quot;home, wassup, videos, comments%26quot; buttons on the top on this site

www.gangstacardtricks.co.nrHow do I make a link change to a different picture when hovered over?
If you have access to the HTML code, add a wee JavaScript event callback for the %26quot;onMouseOver%26quot; event on the image....



Try this



%26lt;script language=%26quot;javascript%26quot; type=%26quot;text/javascript%26quot;%26gt;



var ImgNo = 0 ;



var ImgNames = new Array ( %26quot;flora/flora_00.gif%26quot;, %26quot;flora/flora_01.gif%26quot;, %26quot;flora/flora_02.gif%26quot;, %26quot;flora/flora_04.gif%26quot;, %26quot;flora/flora_05.gif%26quot; ) ;



function newImg () {

var e = document.getElementById ( %26quot;myimg%26quot; ) ;

ImgNo++ ;

if (ImgNo %26gt; 4) ImgNo = 0 ;

e.outerHTML = '%26lt;img id=%26quot;myimg%26quot; border=%26quot;0%26quot; onmouseover=%26quot;newImg()%26quot; src=%26quot;' + ImgNames[ImgNo] + '%26quot;%26gt;'

}

%26lt;/script%26gt;



%26lt;/head%26gt;



%26lt;body%26gt;



%26lt;p%26gt;%26lt;img id=%26quot;myimg%26quot; border=%26quot;0%26quot; onmouseover=%26quot;newImg()%26quot; src=%26quot;flora/flora_00.gif%26quot;%26gt;%26lt;/p%26gt;



%26lt;/body%26gt;



%26lt;/html%26gt;How do I make a link change to a different picture when hovered over?
it depend on if you are using code or a web editor tool

No comments:

Post a Comment