Thread: css rollover

Page 2 of 2 First 12
  • Jump to page:
    #16
  1. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2004
    Location
    0ffice[c0mput3r] || (Uni())
    Posts
    543
    Rep Power
    11
    To correct the error change: SetVisibility to SetVisible (the function name)

    Also change in the function body:
    obj.visibility

    to

    obj.style.visibility

    Should work now, but hit me back just to check anyways.
  2. #17
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jan 2004
    Posts
    977
    Rep Power
    11
    Thanks its all working now. So now it will work in most browsers right?
  4. #18
  5. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2004
    Location
    0ffice[c0mput3r] || (Uni())
    Posts
    543
    Rep Power
    11
    Definitely!


    enjoy.
  6. #19
  7. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jan 2004
    Posts
    977
    Rep Power
    11
    Just wondering... what exactly does the below script do?


    <script type="text/javascript" language="javascript">


    function SetVisible(elementID, visible)
    {
    var obj = null;

    if(document.getElementById)
    obj = document.getElementById(elementID);
    else if(document.all)
    obj = document.all[elementID];

    if(obj != null)
    {
    if(visible == null)
    visible = true;

    obj.style.visibility = (visible ? 'visible' : 'hidden');
    }
    }
    </script>
  8. #20
  9. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2004
    Location
    0ffice[c0mput3r] || (Uni())
    Posts
    543
    Rep Power
    11
    >> Just wondering... what exactly does the below script do?

    Explanation:

    function SetVisible(elementID, visible)
    {
    var obj = null; // initialize var obj, in case none of the object detection methods succeed

    if(document.getElementById) // is getElementById method supported by this browser?
    obj = document.getElementById(elementID); // it is, try to retrieve element's object
    else if(document.all) // is document.all supported by this browser?
    obj = document.all[elementID]; // it is, try to retrieve element's object

    if(obj != null) // was the object retrieved?
    {
    if(visible == null) // it was; was variable visible defined a value?
    visible = true; // no, assume user wants to make element visible

    obj.style.visibility = (visible ? 'visible' : 'hidden'); // set new element's visibility property
    } // end_ if
    } // end_function_body


    BTW:

    getElementById
    This is the method being used by almost all the browsers nowadays according to the W3C specs. (including IE's newest versions)

    document.all
    Internet Explorer's way of addressing objects.

    Hope this clarified you.
    Last edited by #ShAm4n; February 9th, 2004 at 12:34 PM.
Page 2 of 2 First 12
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo