SitePoint Sponsor

User Tag List

Results 1 to 18 of 18
  1. #1
    SitePoint Member
    Join Date
    Jan 2002
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Advanced DHTML mystery!

    Hi,
    I designed a site that includes a nice little javascript rollover which places descriptions for links on a moving layer.
    It has uncovered a bug in Netscape that I need to fix (or at least workaround).

    Basically, the code writes a div for the layer
    DIV ID="overDiv" STYLE="position:absolute; visibility:hidden; z-index:1000;" /DIV

    In IE, it works just fine, but in Netscape, the div repeats within itself:
    DIV ID="overDiv" STYLE="position:absolute; visibility:hidden; z-index:1000;" DIV ID="overDiv" TTYLE="position:absolute; visibility:hidden; z-index:1000;" /DIV

    Note that "STYLE" is now spelled "TTYLE". When the style portion of the tag is removed, it doesn't repeat, but the layer doesn't work (creates a js error).

    Anyone run into this before with Netscape?

    Oh, the site is: http://www.thinkvermont.com/
    Best example is: http://www.thinkvermont.com/infrastructure/index.cfm
    (view source in Netscape 4.x and see what I mean)

    Any help would be greatly appreciated!!!

  2. #2
    What? Maelstrom's Avatar
    Join Date
    Oct 2001
    Location
    Whistler BC originally from Guelph Ontario
    Posts
    2,175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I assume you are having problems with netscape4.x? Correct? If not ignore what I am gonna write.

    <div> layers do not work correctly in netscape as they are not supported. Id labels also do not register within netscape. You may want to try 'name'ing each layer.

    Although that is a strange bug I have a feeling its because of incompatibility. If you are looking for something to work in netscape4.x you will have to use <layer> tag to make it work correctly
    Maelstrom Personal - Apparition Visions
    Development - PhP || Mysql || Zend || Devshed
    Unix - FreeBSD || FreeBsdForums || Man Pages
    They made me a sitepoint Mentor - Feel free to PM me or Email me and I will see if I can help.

  3. #3
    SitePoint Guru Vincent Puglia's Avatar
    Join Date
    Feb 2000
    Location
    where the World once stood
    Posts
    700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi gtivr4,

    Yes, I have seen that 'ttyle' once before -- if I remember correctly -- in a thread at Javascript City. If you go there and use the search button, I'm sure you'll find it.

    My recommendation: write the div style inside of "<style type='text/css'> tags, taking them out of the <div> tag.

    Maelstrom:
    <div> layers do not work correctly in netscape as they are not supported. Id labels also do not register within netscape
    You know I have to disagree with that. Divs just don't work the same as with IE & NN6; they need to be positioned absolutely -- which the one above is.

    Vinny
    Where the World Once Stood
    the blades of grass
    cut me still

  4. #4
    SitePoint Enthusiast
    Join Date
    Jan 2002
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Div's, and ID's are supported positioned absolute, or relative in NetScape 4, or at least they work properly.
    As for the ttyle, I've seen that happen when using document.write(), if I remember correctly, it was because their was no line break, so I added a few \n\n, and that took care of it, but that was awhile ago cant be certain that will help.

  5. #5
    JavaScript Guru (Big Ego) Arielladog's Avatar
    Join Date
    Jul 1999
    Location
    SC, USA
    Posts
    390
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey,

    I've run into this problem many, many times. Basiclaly, it's more or less a bug in netscape. What you should do is use

    <layer> for NN 4.

    aDog

  6. #6
    SitePoint Enthusiast
    Join Date
    Jan 2002
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    NO NO layer evil!

  7. #7
    JavaScript Guru (Big Ego) Arielladog's Avatar
    Join Date
    Jul 1999
    Location
    SC, USA
    Posts
    390
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's the way to get NN 4 to work. Also, DIVs relatively supported don't work to well in NN 4. Absolutely positioned DIVS USUALLY work.

    aDog

  8. #8
    SitePoint Guru Vincent Puglia's Avatar
    Join Date
    Feb 2000
    Location
    where the World once stood
    Posts
    700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you tell aDog

    Vinny
    Where the World Once Stood
    the blades of grass
    cut me still

  9. #9
    SitePoint Enthusiast
    Join Date
    Jan 2002
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I never use layers cause they are stupid, no good dhtml developer does, except in certain rare situation, and your kidding about div's not working relatively positioned, right? you must be, or your just not so bright - one or the other, cause they do work.


  10. #10
    JavaScript Guru (Big Ego) Arielladog's Avatar
    Join Date
    Jul 1999
    Location
    SC, USA
    Posts
    390
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Relatively positioned DIVs in NN 4 can have their CSS style's changed, but their content cannot be changed. What it usually does is wipes the layer's content out completely. Instead, if you need relatively positioned elements to have their content changed (like, you want it in a table cell), you need to use:

    <ilayer><layer>content</layer></ilayer>

    But, this is besides the point of this topic.

    Anyway, in netscape 4, when you change the layer's content, you are changing the innerHTML of it. In other words, if I have:

    <div id="myLayer">blah</div>
    <script>
    content = '<div id="myLayer">blah2</div>';

    with(document.layers["myLayer"].document){
    open();
    write(content);
    close();
    }
    </script>

    It should create two layers like this:

    <div id="myLayer"><div id="myLayer">blah2</div></div>

    So, you need to that layer's parent node rather than that layer if you want to replace it.

    Also, DIVs (and even layers) in NN 4 are buggy, so try using <layer>s and see if that helps. Also, posting some code helps.

    aDog

  11. #11
    SitePoint Guru Vincent Puglia's Avatar
    Join Date
    Feb 2000
    Location
    where the World once stood
    Posts
    700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Flyswatter,

    I never use layers cause they are stupid, no good dhtml developer does, except in certain rare situation, and your kidding about div's not working relatively positioned, right? you must be, or your just not so bright - one or the other, cause they do work.
    1) I always thought I was a decent coder (maybe even a tad bit above the norm), but I guess I'm not -- since I do use layers -- for any dHTML code that is not on an IE-only intranet

    2) aDog is correct about relatively positioned DIVs and NN4

    Vinny
    Where the World Once Stood
    the blades of grass
    cut me still

  12. #12
    SitePoint Enthusiast
    Join Date
    Jan 2002
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey Vincent,

    Just wondering what doesn't work about this? (a very simple example I wrote in about 2 sec.)

    It's just that I've been developing cross browser dhtml for 2 years now, and your telling me that something I've used many times doesn't work, The part thats difficult to understand is (you could have tested it in about 2 sec), and see that it does work, then we would have to be having this conversation.

    <table width="100%" cellspacing="2" cellpadding="2" border="1">
    <tr>
    <td>11</td>
    <td>11</td>
    <td>11</td>
    </tr>
    <tr>
    <td>22</td>
    <td>22</td>
    <td>22</td>
    </tr>
    <tr>
    <td>33</td>
    <td><div id="div1" style="position: relative; layer-background-color: Aqua;">33x</div></td>
    <td>33</td>
    </tr>
    <tr>
    <td>44</td>
    <td>44</td>
    <td>44</td>
    </tr>
    </table>



    /////// ASLO ////////



    The above code, isn't writen so well either,

    <div id="myLayer">blah</div>
    <script>
    content = '<div id="myLayer">blah2</div>';

    with(document.layers["myLayer"].document){
    open();
    write(content);
    close();
    }
    </script>

    It should create two layers like this:

    <div id="myLayer"><div id="myLayer">blah2</div></div>
    Im sure it will output what you say it does, but haveing 2 div with the same id, especially if its nested inside itself, "isnt good".


    Peace

  13. #13
    SitePoint Guru Vincent Puglia's Avatar
    Join Date
    Feb 2000
    Location
    where the World once stood
    Posts
    700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi flyswatter,

    regarding the first:
    <script language="javascript">
    document.layers['div1'].document.open()
    document.layers['div1'].document.write('hello')
    document.layers['div1'].document.close()
    document.layers['div1'].visibility = 'visible'
    </script>

    regarding the second, according to NN4's javascript console: 'document.layers.myLayer has no properties.'

    There are times when I use <div> instead of <layer>, but it is dependent upon the need.

    Vinny
    Where the World Once Stood
    the blades of grass
    cut me still

  14. #14
    JavaScript Guru (Big Ego) Arielladog's Avatar
    Join Date
    Jul 1999
    Location
    SC, USA
    Posts
    390
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Fly Swatter
    The above code, isn't writen so well either,



    Im sure it will output what you say it does, but haveing 2 div with the same id, especially if its nested inside itself, "isnt good".
    I totally agree with you, but I was using it to illustrate a point that if you wanted to replace that layer, that is not the way to go about doing it.

    Also, in your example, you can't replace the content (unless there's another way to write to a layer in NN 4 that you seem to know--if you do, please share). Also, in a table, relatively positioned DIVs can't seem to have their style changed either (as well as their content).

    aDog
    Last edited by Arielladog; Jan 24, 2002 at 19:06.

  15. #15
    JavaScript Guru (Big Ego) Arielladog's Avatar
    Join Date
    Jul 1999
    Location
    SC, USA
    Posts
    390
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Vincent Puglia
    1) I always thought I was a decent coder (maybe even a tad bit above the norm), but I guess I'm not

    Vinny
    Hmmm, do you really think I'd miss such a great opportunity to jive you Vinny

    aDog

  16. #16
    SitePoint Enthusiast
    Join Date
    Jan 2002
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I suppose I didn't know that we we're talking about writing to the div, cause I never look at the script of the original post , My apologies,

  17. #17
    SitePoint Guru Vincent Puglia's Avatar
    Join Date
    Feb 2000
    Location
    where the World once stood
    Posts
    700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Flyswatter,


    ...cause I never look at the script of the original post , My apologies,
    Apologies accepted. It takes wisdom to admit wrong.
    I know everyone jumps to conclusions occasionally -- and when we do, sometimes we're wrong and sometimes we're right -- I just felt you shouldn't have all of the 'bright' stuff.

    CYA on the boards

    aDog: keep it up and I'll send you to the kennels

    Vinny
    Where the World Once Stood
    the blades of grass
    cut me still

  18. #18
    JavaScript Guru (Big Ego) Arielladog's Avatar
    Join Date
    Jul 1999
    Location
    SC, USA
    Posts
    390
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey Fly Swatter,

    Apology accepted. And, like vinny, I understand that we jump to comlusions sometimes (I do it all the time), but the only thing I really have a problem with is the fact that there was personal slander involved. Perhaps it was just a "phrase" to you, but to me, it was a "dis" aimed at me.

    Vinny, good luck trying to take me to the kennel. This dog puts up a fight, and I don't think your old bones can handle it

    gtivr4, was your problem solved?

    aDog


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
  •