JavaScript HTML help!?

  • Thread starter Thread starter lkool
  • Start date Start date
L

lkool

Guest
That is javascript:

<img src="Bonsai.gif" alt=my image is cool"
onmouseover="this.src='Koi.gif'" onmouseout="this.src='Bonsai.gif'" />

You change to the new image onmouseover and then back to the original on mouseout
 
1: Google is your friend, learn to use it.
2: If you don't know how to find out, you really shouldn't be coding a website.
3:
inside script tags, in the source code of the page you linked, you can easily see:

sfHover = function() {
var sfEls = document.getElementById("nav").getElementsByTagName("li");
for (var i=0; i<sfEls.length; i++) {
sfEls.onmouseover=function() {
this.className+=" sfhover";
}
sfEls.onmouseout=function() {
this.className=this.className.replace(new RegExp(" sfhover\b"), "");
}
}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);


so it's fairly clear how they did it.
Next time, view the source before asking stupid questions.
 
I found this cool feature, I don't know what it is called, but it may be a part of HTML, JavaScript or something, so I wanted to know,:

a: How can you make an image change into another when pointed by cursor.
b: What code should I add to do this?

Here's an example, move your cursor in the "Learn to Play" image.:
http://www.yugioh-card.com/en/
Best answer has a sure 10-points! TY in advance ^_^
 
Back
Top