Click to See Complete Forum and Search --> : MouseOver


quixote
04-26-2003, 10:31 AM
I'm a bit new to DHTML and Javascript. I was wondering if someone could give me a simple example of a mouse rollover effect.
Let's say I have text or an image (whatever is easier) of the word "Hello". When I roll over it I would like either text or an image(again whatever is easier) to show up somewhere else on the page saying "Hello There". When my mouse leaves the word Hello, "Hello There" disappears.

Thanks

khalidali63
04-26-2003, 10:38 AM
Check this out

http://68.145.35.86/skills/javascripts/SimpleImageSwap.html

cmelnick
04-26-2003, 12:20 PM
position your mouse over the word "hello" to change it...<br><br>

<!--
To change text on a separate part of the page, create one <span> with the mouseover below, and another span that the functions changeWordTo and resetWord() work on.
-->

<span id="change" onMouseOver="changeWordTo('world');" onMouseOut="resetWord();">Hello</span>



<script language="javascript">
function changeWordTo(word) {
var elem = document.getElementById("change");
elem.innerHTML = word;
}
function resetWord() {
var elem = document.getElementById("change");
elem.innerHTML = "Hello";
}
</script>