SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Hybrid View

  1. #1
    SitePoint Evangelist goughb's Avatar
    Join Date
    Sep 2000
    Location
    Chicago
    Posts
    526
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Does anyone know how netscape 6 uses layers in regards to making them visible and hidden with javascript.

    Thank You.

  2. #2
    SitePoint Addict
    Join Date
    Oct 2000
    Posts
    304
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So far as I can see from a quick test, it remains the same as in NS 4.X.

  3. #3
    SitePoint Zealot Website Rob's Avatar
    Join Date
    Aug 2000
    Location
    Alberta, Canada
    Posts
    113
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's not quite true. Netscape 6 is "way" different from any previous versions. Thankfully it is on the road to being more Standards complient than any other Browser currently available. Still a few bugs to work out though. Apparently they were more concerned with meeting a Release Date, than they were in providing a really nice Browser.

    A sampling of bugzilla bugs, that affect Navigator's standards compliance include:
    • #40828: The padding of cells in HTML tables is lost when the table is hidden and reshown using the CSS and DOM standards. A fix is available for this bug, but has been refused by the PDT. The discussion of this bug includes an impassioned plea from a developer for the fix to be included in Navigator 6.0.
    • #57634: HTML <DL> elements may not be nested within <DD> elements. Although this practice is common, and a fix for the bug is available, Netscape will not fix this bug for Navigator 6. Instead, they will simply document it in the release notes.
    • #49120: JavaScript cannot be used to set the properties of HTML hyperurls until the user has already interacted with the url. This is a bug in DOM Level 0 compliance. It is also incompatible with previous releases of Navigator, which do allow url properties to be manipulated programmatically. There is a proposed fix for this bug.
    • #58753: The Document.referrer property (specified by DOM Level 0) is not correctly implemented.
    • #9850 The DOM method createEntityReference() does not function.
    • #48031: The DOM methods removeChild() and replaceChild() can crash the browser. There is a patch available for this bug, but it will not be applied for Navigator 6.0.
    • #58007: The JavaScript Date.toDateString() and Date.toTimeString() are specified by the ECMAScript standards, but are not implemented. This has been fixed in the Mozilla sources, but the fix will not be adopted for Netscape 6.
    • #56320: The JavaScript Error() constructor method does not work as specified by the ECMAScript standard when called as a function. The fix for this bug has been refused by the PDT.
    • #57048 The JavaScript Object.propertyIsEnumerable() method does not work as specified by the ECMAScript standard.
    And to answer "goughb" question:

    In Netscape v4.x there are Browser specific tags ( specifically: document.layers and <LAYER> ) that is "not" Standards complient. Yet many people used it in their code. Now with v6.0 getting rid of previous Netscape "Browser specific code" and conforming more to Standards, it's easy to see that the Browser is not at fault. Other faults Yes, but the less "Browser specific code" people have to worry about, the better.

    Here's an example script for hiding/unhiding DIVs. Just pass it the ID of a DIV and it toggles the DIV:

    function reveal(divname)
    {
    if (document.layers) //OLD SCHOOL NETSCAPE (4.0)
    {
    visible = 'show';
    hidden = 'hide';
    obj = document.layers[divname];
    }
    else if (document.all) //OLD SCHOOL IE (4.0)
    {
    visible = 'visible';
    hidden = 'hidden';
    obj = document.all(divname).style;
    }
    else if (document.getElementById) //NEW IE5+ && NETSCAPE 6
    {
    visible = 'visible';
    hidden = 'hidden';
    obj = document.getElementById(divname).style;
    }

    if (obj.visibility == visible)
    {
    obj.visibility = hidden;
    }
    else
    {
    obj.visibility = visible;
    }
    }

    As you can see, using "document.getElementById" is Standards complient and works in both newer versions of IE & Netscape. By adopting the above, code can be re-written for all Browsers and help people get into the habit of coding to Standards.

    Not to say that some of the Browser specific code isn't pretty nifty (filters in IE for another example) but we should always code pages so that they work fine in any Browser, and the ones that will display Browser specific code, will. This way pages degrade nicely, will show cool code if able to, and above all - will not break in version "whatever" of a Browser.

    The majority of the problems with most Web sites, is that people code to the "Browser" rather than to the Standards. A lot of code will have to be changed as each new Browser version, becomes more & more Standards complient, and Browser specific code becomes less & less.

    A lot of people are now looking at having to re-write their code to make it render properly in NN6, and that is as it should be. They will still have the problem of figuring out "how to" code for backwards compatibility and that's where the above example code will come in handy.

    Code to Standards or code to Browsers, but know that Standards will win - everytime.

  4. #4
    SitePoint Evangelist goughb's Avatar
    Join Date
    Sep 2000
    Location
    Chicago
    Posts
    526
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Excellent.. Thank You!

  5. #5
    SitePoint Addict
    Join Date
    Oct 2000
    Posts
    304
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Some great information, there, Rob. Thank you.

  6. #6
    SitePoint Zealot Website Rob's Avatar
    Join Date
    Aug 2000
    Location
    Alberta, Canada
    Posts
    113
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No sweat guys. Glad you found the information helpful.

  7. #7
    Jules
    SitePoint Community Guest
    This looks great but I'm having troube implementing it...(self confessed Javascript Hack)

    I'm trying to pass the ID like this...
    <a href=# onMouseOver="reveal(mylayer)">Toggle my layer</a>

    Here's my div...
    <div id="mylayer" style="position:absolute; visibility: hidden; left: 5; top: 250">
    Hi!
    </div>

    In the past I've used the dreamweaver "MM_showHideLayers" funtions which naturally do not work in N6.


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
  •