Click to See Complete Forum and Search --> : can you help me make "sticky" text?


munna
08-21-2003, 07:27 AM
I've got this html page (see below) which shows some more text at an onmouseover event. But my problem is that I can't figure out how to make the <div> with the "full text" bit stick -- I mean remain on screen till you refresh the page or something -- once you click on the "Come here to see full text!" bit. Any auggestions, please?
-----------
<html>
<body>

<SCRIPT LANGUAGE="JavaScript"> function displaytext() { if (document.layers) document.layers["Main"].visibility='show'; else document.all["Main"].style.visibility='visible'; }
function hidetext() { if (document.layers) document.layers["Main"].visibility='hide'; else document.all["Main"].style.visibility='hidden'; }
function sticktext() { if (document.layers) document.layers["Main"].visibility='show'; else document.all["Main"].style.visibility='visible'; } </SCRIPT>
<a class="title" onMouseOver="displaytext();" onMouseOut="hidetext();" onClick="sticktext()"> Come here to see full text! </a>

<DIV ID="Main" style="position:absolute; LEFT:20; TOP:55; Z-INDEX:2;VISIBILITY:hidden">
full text full text full text full text
<br>
full text full text full text full text
<br>
full text full text full text full text
</div>

</body>
</html>
---------

A1ien51
08-21-2003, 07:31 AM
remove the onMouseOut="hidetext()" part

if you wtill want it to flip back if you do not click then you need to keep that part and add a flag (variable) that says I been clicked, do you change back

pyro
08-21-2003, 07:38 AM
document.layers : proprietary NS 4
document.all : proprietary IE 4
document.getElementById : Valid DOM
If you want this to work in older browsers, you can leave the document.layers and document.all in there, but you should add the document.getElementById for DOM capable browsers...

munna
08-21-2003, 08:25 AM
Hi guys,
can you show me exactly how to implement your advice -- I've only just started with writing my own javascript and am not quite sure...
thanks so much!