Link to home
Start Free TrialLog in
Avatar of tsuyoshi
tsuyoshi

asked on

Change text with onmouseover/onmouseout

We can change images with onmouse.... events. But I'd like to change text with this events. Can I do it?

Thanks.

Avatar of avner
avner

a simple IE only example is :

<SPAN onmouseover="this.innerText='MOSHE !!!'" onmouseout="this.innerText='NONONO !!!'">Roll Over ME</SPAN>
something more Cross Brosers would be :

<SCRIPT LANGUAGE="JavaScript">
<!--
sON="<font color='#FF3366'>test</font>"
sOUT="<font color='#663399'>test</font>"
function ch(that){
if (document.all) {

if (that==1) moshe.style.color="#FF3366";
else
moshe.style.color="#663399";
}
          else {
          ref=document.layers.w.layers.moshe.document
if (that==1) {ref.write(sON);ref.close();}
else
{ref.write(sOUT);ref.close();}
}
}
//-->
</SCRIPT>
<layer id="w" name="w" onMouseOver="ch('1')" onMouseOut="ch('2')">
<div id=moshe name=moshe style="position:absolute" onMouseOver="ch('1')" onMouseOut="ch('2')">
test
</div>
<layer>
Avatar of tsuyoshi

ASKER

Ok thank you. But I think that it isn't what I really need.
I'd like to pass the mouse over the picture, and change a text in another place, like a status panel.

PS:Sorry if my English is wrong.
ASKER CERTIFIED SOLUTION
Avatar of avner
avner

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
YES! Thank you very much!

PS: You're very fast to answer!
You are more then welcome.
That works only on IE.