PDA

Click to See Complete Forum and Search --> : <div><layers> and dynamic text w/ mouseOver...


pnj
Dec 13th, 2000, 06:49 PM
hello,
I have an <a href> on the left side of my screen.
on the right side I have some text. I want to have javascript that works in both browser and when I roll over the <a href> the text on the right side of the screen will change.


I have tried using the <div ID="newText">
and <layer ID="newText">but I can only get it to work in one browser or the other not both.
I haven't include my code becouse I think it is so messed up it will just mess you up worse than not seeing it at all.


if this makes no sense let me know and I will rewrite it so it is easyier to understand.

basicly I want to do what you could do w/ an image swap only I want to use text.

thanks

Mark Sreeves
Dec 15th, 2000, 03:52 AM
this works with IE and Netscape 4


<HTML>
<HEAD>
<script language=javascript>
var ntext;
var otext;
function init()
{
if (document.all) {ntext = object1.style}
if (document.all) {otext = object2.style}
if (document.layers) {ntext = document.object1}
if (document.layers) {otext = document.object2}
}


function oldText()
{
otext.visibility = 'hidden';
ntext.visibility = 'visible';
}

function newText()
{

ntext.visibility = 'hidden';
otext.visibility = 'visible';
}


</script>
</HEAD>
<BODY onLoad="init()">
<a href="" onMouseover="newText()" onMouseout="oldText()">click here</A>

<div ID="object1" STYLE="position:absolute;top:10;left:270">
Old Text
</div>
<div ID="object2" STYLE="position:absolute;top:10;left:270;visibility:hidden">
new text

</div>


</BODY>
</HTML>

pnj
Dec 15th, 2000, 10:50 AM
thanks a bunch,
that is super cool.