SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Member
    Join Date
    Mar 2004
    Location
    London
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Cool Help hiding a table in NS4

    Hello all

    I am trying to write a script that will hide a table in NS4.

    getElementById only works with IE4+ +NS 7 anyone go any idea how to adapt to function below to support NS4?

    function hide(st)
    {
    document.getElementById("hide").style.display=st;

    }

  2. #2
    SitePoint Guru
    Join Date
    Mar 2004
    Location
    Earth
    Posts
    406
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can't change the display of an object in Netscape 4. The only way to change content dynamically is to use its <layer> setup.

    I and others can give you info if you're interesested, but it's not for the feint hearted - do you really want to take the time to learn an obsolete DHTML model for a browser nobody uses?

  3. #3
    SitePoint Member
    Join Date
    Mar 2004
    Location
    London
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Cool

    Quote Originally Posted by brothercake
    You can't change the display of an object in Netscape 4. The only way to change content dynamically is to use its <layer> setup.

    I and others can give you info if you're interesested, but it's not for the feint hearted - do you really want to take the time to learn an obsolete DHTML model for a browser nobody uses?
    My boss is fussy and ideally wants NS4 support. It would be good if you could help as my JavaScript is pretty poor.

    This does what more of less what want to but gives errors on the page that I need to use it.

    <script language="javascript">
    <!--

    ns4 = (document.layers)? true:false
    ie4 = (document.all)? true:false

    function show(id) {
    if (ns4) document.layers[id].visibility = "show"
    else if (ie4) document.all[id].style.visibility = "visible"
    }

    function hide(id) {
    if (ns4) document.layers[id].visibility = "hide"
    else if (ie4) document.all[id].style.visibility = "hidden"
    }

    //-->
    </script>



    http://phpscripter.mmaweb.net/mediab...n/register.php

    This is the page that I'm working on I assume I need to need to integrate a document.layers method call in to my hide function.

  4. #4
    SitePoint Member
    Join Date
    Mar 2004
    Location
    London
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How would I adapt something like this? plz help!

    <script language="JavaScript">
    var NN4 = document.layers? true : false;
    var IE4 = document.all? true : false;

    function hide(layerName) {
    if (W3C) {
    document.getElementById(layerName).style.visibility = "hidden";
    }
    else if (IE4) {
    document.all[layerName].style.visibility = "hidden";
    }
    else if(NN4) {
    document.layers[layerName].visibility = "hidden";
    }
    }

    </script>

  5. #5
    SitePoint Guru
    Join Date
    Mar 2004
    Location
    Earth
    Posts
    406
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That should work, but you have to have a layer to identify - a layer means either <layer>, <ilayer> or an absolutely-positioned <div>

    So which element are you hiding? You need to surround it in one of those elements and the give it the applicable NAME or ID - if you use a DIV with an ID, then you can identify it cross browser using the code you have.

    Does that make sense?

  6. #6
    SitePoint Member
    Join Date
    Mar 2004
    Location
    London
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by brothercake
    That should work, but you have to have a layer to identify - a layer means either <layer>, <ilayer> or an absolutely-positioned <div>

    So which element are you hiding? You need to surround it in one of those elements and the give it the applicable NAME or ID - if you use a DIV with an ID, then you can identify it cross browser using the code you have.

    Does that make sense?
    Could you give me a example.

    I need to hide the table rows below Employer on if either of the Freelancer or Retired radio options are selected see.

    http://phpscripter.mmaweb.net/mediab...n/register.php

  7. #7
    SitePoint Member
    Join Date
    Mar 2004
    Location
    London
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's ok I've more or less worked it out now.


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
  •