onMouseOver to change/hide text

C

CQMMAN

Hello,

I am trying to change a piece of text using onmouseover. I have tried a few
things so far and nothing has really worked. I get get a new piece of text
to appear but bastardizing someone elses code, but can't figure out how to
hide the other one....

I sort of have the following but don't know if this is close to the best way
of doing it really...

Basically I want to have a piece of text, lets say TEXT1, that changes from
blue to red, and to TEXT2 while the mouse is over it.

I know nothing really about Java so have had a look around but got no
futher. Any help would be great.

Cheers




<html>
<head>
<script type="text/JavaScript">
function setText(t){
if(document.layers)
{
with(document.layers["myDiv"].document)
{
open();
write(t);
close();
}
}
else if(document.all)
{
myDiv.innerHTML = t;
}
}
</script>
</head>
<body>
<a href="#"
onmouseover="setText('test2)",
onmouseout="setText('')">test1</a>&nbsp;


&nbsp;<br>
<div style="position:absolute;top:14;left:11;width:100;" name="myDiv"
id="myDiv"></div>
</body>
</html>
 
C

Christophe Vanfleteren

CQMMAN wrote:

I know nothing really about Java so have had a look around but got no
futher. Any help would be great.

Java != javascript

<snip javascript>

comp.lang.javascript is that way ----------------->
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top