/    Sign up×
Community /Pin to ProfileBookmark

can you help me make "sticky" text?

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>
———

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@A1ien51Aug 21.2003 — 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

Copy linkTweet thisAlerts:
@pyroAug 21.2003 — [list]
  • [*]document.layers : proprietary NS 4

  • [*]document.all : proprietary IE 4

  • [*]document.getElementById : Valid DOM

  • [/list]
    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...
    Copy linkTweet thisAlerts:
    @munnaauthorAug 21.2003 — 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!
    ×

    Success!

    Help @munna spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.20,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...