Div versus Layer

Results 1 to 7 of 7

Thread: Div versus Layer

  1. #1
    Tim Warke Guest

    Default Div versus Layer

    Man I have a lovely little show/hide script running in MSIE using DIV. Only to find Netscape chews it up and spits it out.<BR><BR>Trying to use the layer tag to replicate it, but can&#039;t get layer to hide anything!!<BR><BR>Even this simplest code won&#039;t hide the layer:<BR>&#060;layer id="Layer1" width="200" height="115" z-index="1" visibility="hide"&#062;This <BR>is a hidden layer&#060;/layer&#062;<BR><BR>Is there something wrong with the above?<BR><BR>Thanks Tim<BR>

  2. #2
    J. Paul Schmidt Guest

    Default RE: Div versus Layer

    Here are some links you hopefully might find helpful:<BR><BR>DynAPI - Cross-Browser DHTML Library originally by Dan Steinman but improved by others<BR>http://dynapi.sourceforge.net/dynapi<BR>Latest zipped release can be downloaded.<BR><BR>Dynamic Duo - Layer Writing by Dan Steinman - 1998<BR>http://www.dansteinman.com/dynduo/en/writing.html<BR>One page from the older original DynAPI.<BR><BR>Best regards,<BR>-Paul<BR><BR>J. Paul Schmidt, MBA<BR>Databases on the Web<BR>http://www.Bullschmidt.com<BR><BR><BR>

  3. #3
    Join Date
    Dec 1969

    Default RE: Div versus Layer

    netscape should be fine with DIV tags - see the example javascript code on http://www.infinitemonkeys.ws/ for a cross-platform example. - showing your code here may clear things up a bit too...<BR><BR>j

  4. #4
    Tim Warke Guest

    Default RE: Div versus Layer

    Thanks guys,<BR><BR>Can Netscape handle something like this:<BR><BR>&#060;div id="st473" style="display:&#039;none&#039;;" align="left"&#062;<BR>Hidden message here<BR>&#060;/div&#062;<BR><BR>As I realised the visibility option doesn&#039;t make space for the hidden text when revealing it - but display does. Although I can&#039;t get it to work on Netscape.<BR><BR>I am using a Jscript to show/hide it - but again it only works on MSIE:<BR><BR>&#060;script LANGUAGE="JavaScript"&#062;<BR>&#060;!--<BR>function changestate(stnum,imnum) {<BR>if (stnum.style.display==&#039;&#039;) {<BR>imnum.src=&#039;more.gif&#039;;<BR>stnum.styl e.display=&#039;none&#039;;<BR>} else {<BR>imnum.src=&#039;close.gif&#039;;stnum.style.d isplay=&#039;&#039;;<BR>}<BR>}<BR>//--&#062;<BR>&#060;/script&#062;<BR><BR>Thanks again<BR><BR>Tim<BR>

  5. #5
    Amy Gilchrist Guest

    Default RE: Div versus Layer

    When I paste your layer code above into an HTML page and view it in Netscape 4.75, it works fine for me -- I don&#039;t see the layer. And if I change visibility to show, then I see it.<BR><BR>Which version of Netscape are you using?

  6. #6
    Amy Gilchrist Guest

    Default RE: Div versus Layer

    It looks like you are trying to make one of those expandable/collapsable lists. In my experience, it just isn&#039;t worth trying to make these work in Netscape 4.<BR><BR>From what I&#039;ve seen, Netscape 4 understands "display:none;" on a div tag well enough not to show the div&#039;s contents on the screen, but you aren&#039;t able to manipulate the display property though script. That means you can hide the div, but never show it again.<BR><BR>There are scripts out there, this one (http://developer.netscape.com/docs/technote/dynhtml/collapse/index.html) for example, that work in Netscape 4 by using the visibility attribute and moving all of the items up and down when the user expands or contracts the list. I haven&#039;t had good luck using these. One client complained that it made their pages load so slowly that they asked for it to be removed.<BR><BR>Another downer to the script at the link above is that I&#039;m betting it doesn&#039;t work in Netscape 6, although I&#039;ve never tried it.<BR><BR>Consequently, I&#039;ve given up on doing expanding and contracting menus for Netscape 4. I use code similar to what you have above to expand and contract the menus in IE 4+ and Netscape 6. Then I use a server-side browser detect to write a blank style attribute or "display:inline;" for the Netscape 4 and alternative-browser folks, so that at least they will be able to see all of the items in the list with no DHTML.

  7. #7
    Jim Marion Guest

    Default RE: Div versus Layer

    Amy is right on here. The layer object is not the same as the layer tag. The layer object is a scriptable representation of the layer tag. Netscape v4.x doesn&#039;t recognize the display property of the layer object (positioned div elements nested directly under the root document are considered layers in Netscape Communicator). The layer tag, however, recognizes the display property through the style attribute. Furthermore, Netscape&#039;s layer object doesn&#039;t have a child style object like Microsoft&#039;s IE. To manupulate the visibility of a layer in Communicator, you have to use the visibility property of the layer object (not the visibility property of the style object). Remember, just because a tag has an attribute in Communicator, doesn&#039;t mean the scriptable object represented by that tag has a property that represents that attribute. In fact, several tags in Communicator aren&#039;t even scriptable objects. As far as Communicator JavaScript is concerned, they don&#039;t exist in the object model.<BR><BR>Another method to try is dynamically writing the content you want to display with the document.layers["layerName"].document.write("html to display using html tags") method. Use the write method to write the content you want to display when you want to display it. Use the write method again with a zero length string ("") to delete the content, when you want to hide it.<BR><BR>See http://developer.netscape.com/docs/manuals/communicator/dynhtml/layers33.htm#1042222 for more information regarding Communicator JavaScript and positioned content.<BR><BR>Now that we have discussed Communicator and Netscape v4.0, try not to dwell on it if possible, because v6.0 was just released. Version 6.0 is a completely different animal than v4.0. In fact, you will probably find that a lot of your Microsoft IE code works with Netscape&#039;s v6.0. This is because both browsers are "mostly" based on the W3C Standard DOM. The key to unleashing the new DOM in Netscape v6.0 is to use the appropriate XHTML Document Prolog. See http://www.w3.org/MarkUp/ for more information on XHTML.<BR><BR>God Bless.

Posting Permissions

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