SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Threaded View

  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2002
    Posts
    95
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    DHTML visibility problem

    Can someone please tell me what's wrong with this code:


    ----------------------------------------------------------------
    <div id="moj" style="position:absolute; top: 100px; left: 200px; visibility: visible;">
    a
    </div>

    <script>
    function dom(id) {return document.getElementById(id).style}
    dom('moj').visibility = 'visible';

    function toggleVis() {
    if (dom('moj').visibility = 'visible') {dom('moj').visibility = 'hidden';}
    else if (dom('moj').visibility = 'hidden') {dom('moj').visibility = 'visible';}
    else {dom('moj').visibility = 'visible';}
    }
    </script>

    <button onclick="toggleVis();">Click me!</button>
    ----------------------------------------------------------------


    when I click the button, the div disappears, but when I click it again, the div doesn't show .

    And aonther thing. When an object is invisible... Is it still there? Let my present an example: you have a div, that has visibility: hidden and has a mouseover attribut that sets the visibility of the div to visible. Does the div appear when you roll your mouse over that div?
    Last edited by Rok; Aug 29, 2002 at 06:44.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •