netscape 4.7: onmouseover not working when i put <a> tag within a div tag

Discussion in 'Javascript' started by Eqbal Z, Aug 23, 2003.

  1. Eqbal Z

    Eqbal Z Guest

    Hi,

    I have the following code, and onmouseover/onmouseout etc. does not
    work in netscape 4.7.

    <div id="divUpControl"><a href="javascript:void(0);"
    onMouseOver="PerformScroll(-7);" onMouseOut="CeaseScroll();"
    class="nounderline">[up]</a><a href="javascript:void(0);"
    onMouseOver="PerformScroll(7);" onMouseOut="CeaseScroll();"
    class="nounderline">[down]</a></div>


    I have the style for the divs defined using javascript in the <head>
    section of the page something like this:

    var bAgent = window.navigator.userAgent;
    var bAppName = window.navigator.appName;
    if ((bAppName.indexOf("Netscape") >= 0) &&
    (bAgent.indexOf("Mozilla/4") >= 0) && (bAgent.indexOf("Win") >= 0))
    {
    document.write ('<style type=text/css>')
    document.write ('#divUpControl{position:absolute; width:200;
    left:210; top:160; z-index:1; text-align: right}')
    document.write ('</style>')

    }

    Any ideas on why this could be happenning? Code works fine for IE and
    NS6 and higher.
    Eqbal Z, Aug 23, 2003
    #1
    1. Advertising

  2. Eqbal Z

    Lee Guest

    Eqbal Z said:
    >
    >Hi,
    >
    >I have the following code, and onmouseover/onmouseout etc. does not
    >work in netscape 4.7.
    >
    ><div id="divUpControl"><a href="javascript:void(0);"
    >onMouseOver="PerformScroll(-7);" onMouseOut="CeaseScroll();"
    >class="nounderline">[up]</a><a href="javascript:void(0);"
    >onMouseOver="PerformScroll(7);" onMouseOut="CeaseScroll();"
    >class="nounderline">[down]</a></div>
    >
    >
    >I have the style for the divs defined using javascript in the <head>
    >section of the page something like this:
    >
    >var bAgent = window.navigator.userAgent;
    >var bAppName = window.navigator.appName;
    > if ((bAppName.indexOf("Netscape") >= 0) &&
    >(bAgent.indexOf("Mozilla/4") >= 0) && (bAgent.indexOf("Win") >= 0))
    > {
    > document.write ('<style type=text/css>')
    > document.write ('#divUpControl{position:absolute; width:200;
    >left:210; top:160; z-index:1; text-align: right}')
    > document.write ('</style>')
    >
    > }
    >
    >Any ideas on why this could be happenning? Code works fine for IE and
    >NS6 and higher.


    In Netscape 4, The contents of an absolutely positioned DIV are
    a separate Layer. Your event handlers aren't defined in that
    Layer. Try "window.CeaseScroll()".
    Lee, Aug 23, 2003
    #2
    1. Advertising

  3. Eqbal Z

    Eqbal Z Guest

    > In Netscape 4, The contents of an absolutely positioned DIV are
    > a separate Layer. Your event handlers aren't defined in that
    > Layer. Try "window.CeaseScroll()".


    The methods I am using (PerformScroll, CeaseScroll etc.) are defined
    within the script tag in the <head> of the page. I tried
    window.PerformScroll() and it did not work. Trouble is, it seems to me
    that the mouseover event does not seem to work at all, even if I put
    in onmouseover='alert("test");' it does not work. Any more ideas?
    Eqbal Z, Aug 25, 2003
    #3
  4. Eqbal Z

    Lee Guest

    Eqbal Z said:
    >
    >> In Netscape 4, The contents of an absolutely positioned DIV are
    >> a separate Layer. Your event handlers aren't defined in that
    >> Layer. Try "window.CeaseScroll()".

    >
    >The methods I am using (PerformScroll, CeaseScroll etc.) are defined
    >within the script tag in the <head> of the page. I tried
    >window.PerformScroll() and it did not work. Trouble is, it seems to me
    >that the mouseover event does not seem to work at all, even if I put
    >in onmouseover='alert("test");' it does not work. Any more ideas?



    The following works in Netscape 4 and Netscape 7.
    I set the status line, rather than use alerts, because alert()
    windows in onmouseover handlers are annoying to work with.

    <html>
    <head>
    <style type=text/css>')
    #divUpControl{position:absolute; width:200; left:210; top:160; z-index:1;
    text-align: right}
    </style>
    </head>
    <body>
    <div id="divUpControl"><a href="javascript:void(0);"
    onMouseOver="window.status='up';return true"
    onMouseOut="window.status='out';return true"
    class="nounderline">[up]</a><a href="javascript:void(0);"
    onMouseOver="window.status='down';return true"
    onMouseOut="window.status='out';return true"
    class="nounderline">[down]</a></div>
    </body>
    </html>
    Lee, Aug 25, 2003
    #4
  5. Eqbal Z

    Eqbal Z Guest

    Lee <> wrote in message news:<>...
    > Eqbal Z said:
    > >
    > >> In Netscape 4, The contents of an absolutely positioned DIV are
    > >> a separate Layer. Your event handlers aren't defined in that
    > >> Layer. Try "window.CeaseScroll()".

    > >
    > >The methods I am using (PerformScroll, CeaseScroll etc.) are defined
    > >within the script tag in the <head> of the page. I tried
    > >window.PerformScroll() and it did not work. Trouble is, it seems to me
    > >that the mouseover event does not seem to work at all, even if I put
    > >in onmouseover='alert("test");' it does not work. Any more ideas?

    >
    >
    > The following works in Netscape 4 and Netscape 7.
    > I set the status line, rather than use alerts, because alert()
    > windows in onmouseover handlers are annoying to work with.
    >
    > <html>
    > <head>
    > <style type=text/css>')
    > #divUpControl{position:absolute; width:200; left:210; top:160; z-index:1;
    > text-align: right}
    > </style>
    > </head>
    > <body>
    > <div id="divUpControl"><a href="javascript:void(0);"
    > onMouseOver="window.status='up';return true"
    > onMouseOut="window.status='out';return true"
    > class="nounderline">[up]</a><a href="javascript:void(0);"
    > onMouseOver="window.status='down';return true"
    > onMouseOut="window.status='out';return true"
    > class="nounderline">[down]</a></div>
    > </body>
    > </html>


    Its strange. If I cut and paste your code into a file and open in
    netscape it works, but in my template for the site it doesn't!!! I am
    not sure what I am doing wrong.
    Eqbal Z, Aug 26, 2003
    #5
  6. Eqbal Z

    Lee Guest

    Jim Dabell said:
    >
    >Lee wrote:
    >
    >[snip]
    >> The following works in Netscape 4 and Netscape 7.
    >> I set the status line, rather than use alerts, because alert()
    >> windows in onmouseover handlers are annoying to work with.
    >>
    >> <html>
    >> <head>
    >> <style type=text/css>')
    >> #divUpControl{position:absolute; width:200; left:210; top:160; z-index:1;
    >> text-align: right}

    >[snip]
    >
    >That will break in browsers that follow the CSS specification. The only
    >reason you have been able to get it to work is because you are putting
    >Netscape into "quirks mode", where it deliberately screws up rendering to
    >try and compensate for author errors. It's a much better idea, in my
    >opinion, to write correct code in the first place. Add a doctype, supply
    >units to go with your lengths, and validate your code to find other errors:
    >
    ><URL:http://validator.w3.org/>


    You might try reading the thread before responding.
    I'm echoing back the OP's code, showing that it doesn't
    display the problem he reports.
    Lee, Aug 26, 2003
    #6
  7. Eqbal Z

    Eqbal Z Guest

    (Eqbal Z) wrote in message news:<>...
    > Lee <> wrote in message news:<>...
    > > Eqbal Z said:
    > > >
    > > >> In Netscape 4, The contents of an absolutely positioned DIV are
    > > >> a separate Layer. Your event handlers aren't defined in that
    > > >> Layer. Try "window.CeaseScroll()".
    > > >
    > > >The methods I am using (PerformScroll, CeaseScroll etc.) are defined
    > > >within the script tag in the <head> of the page. I tried
    > > >window.PerformScroll() and it did not work. Trouble is, it seems to me
    > > >that the mouseover event does not seem to work at all, even if I put
    > > >in onmouseover='alert("test");' it does not work. Any more ideas?

    > >
    > >
    > > The following works in Netscape 4 and Netscape 7.
    > > I set the status line, rather than use alerts, because alert()
    > > windows in onmouseover handlers are annoying to work with.
    > >
    > > <html>
    > > <head>
    > > <style type=text/css>')
    > > #divUpControl{position:absolute; width:200; left:210; top:160; z-index:1;
    > > text-align: right}
    > > </style>
    > > </head>
    > > <body>
    > > <div id="divUpControl"><a href="javascript:void(0);"
    > > onMouseOver="window.status='up';return true"
    > > onMouseOut="window.status='out';return true"
    > > class="nounderline">[up]</a><a href="javascript:void(0);"
    > > onMouseOver="window.status='down';return true"
    > > onMouseOut="window.status='out';return true"
    > > class="nounderline">[down]</a></div>
    > > </body>
    > > </html>

    >
    > Its strange. If I cut and paste your code into a file and open in
    > netscape it works, but in my template for the site it doesn't!!! I am
    > not sure what I am doing wrong.


    I noticed that if I put this code outside the <table> tags, it seems
    to work, but within a table (<td>) tag it does not. Is there anyway to
    make it work there?
    Eqbal Z, Aug 27, 2003
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jordan
    Replies:
    1
    Views:
    3,814
    Bruce Barker
    Jun 10, 2005
  2. shruds
    Replies:
    1
    Views:
    737
    John C. Bollinger
    Jan 27, 2006
  3. Patrice
    Replies:
    2
    Views:
    172
    Patrice
    Oct 6, 2003
  4. M Wells
    Replies:
    0
    Views:
    128
    M Wells
    Oct 6, 2004
  5. visu
    Replies:
    4
    Views:
    277
Loading...

Share This Page