Javascript not working in Netscape 7.1

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Norman Swartz

    #1

    Javascript not working in Netscape 7.1

    OS system is Windows XP Pro SP2.

    The following works perfectly in IE but not at all in Netscape:

    <tr>
    <td valign="middle" background="dul l.gif"
    onMouseOver="th is.background=' bright.gif';"
    onMouseOut="thi s.background='d ull.gif';"
    bgcolor="#FFFFF F">
    <img src="vspacer.gi f" height="46" width="20" align="left">
    <span style = "font-size : 6pt">&nbsp;<br> </span>
    <span style="color : 000000; font-size : 9 pt;
    font-family : arial, sanserif">
    <a href="./notices/board.htm"><b>N otice Board</b></a></span></td>
    </tr>

    It's as if Javascript is turned off in Netscape. Is that an effect of
    installing XP SP2? How do I get Javascript to work in Netscape?
  • Michael Winter

    #2
    Re: Javascript not working in Netscape 7.1

    On Tue, 28 Sep 2004 20:09:51 GMT, Norman Swartz <swartz@sfu.c a> wrote:
    [color=blue]
    > OS system is Windows XP Pro SP2.
    >
    > The following works perfectly in IE but not at all in Netscape:
    >
    > <tr>
    > <td valign="middle" background="dul l.gif"
    > onMouseOver="th is.background=' bright.gif';"
    > onMouseOut="thi s.background='d ull.gif';"[/color]

    You should probably be using the style object.
    [color=blue]
    > bgcolor="#FFFFF F">
    > <img src="vspacer.gi f" height="46" width="20" align="left">[/color]

    A spacer GIF? See below.
    [color=blue]
    > <span style = "font-size : 6pt">&nbsp;<br> </span>[/color]

    If you need some spacing, place a top margin on the link, or a bottom
    margin on the image. Don't hack with non-breaking spaces and font sizes.
    The Web should be moving past that rubbish now.
    [color=blue]
    > <span style="color : 000000; font-size : 9 pt;[/color]

    A hash (#) is required to prefix three- or six digit hexadecimal colour
    codes.

    Don't use pt, px, or any other fixed measurement for font sizes. It makes
    text affected by them impossible to resize in some browsers. Use ems or
    percentages instead.
    [color=blue]
    > font-family : arial, sanserif">[/color]

    That should be:

    font-family: Arial, sans-serif;
    [color=blue]
    > <a href="./notices/board.htm"><b>N otice Board</b></a></span></td>
    > </tr>[/color]

    As a general comment, why the piecemeal approach to CSS? Everything that
    you seem to be attempting can be done with CSS[1] yet you've got some
    presentational HTML, some CSS, and some HTML hacks that you'd only expect
    from errant WYSIWYG programs like FrontPage.

    Documents should now be written with Strict HTML and CSS, unless it's a
    legacy page that would take too much effort to fix, or that needs to be
    Transitional for some other reason. Be forward-looking, not stuck in the
    past!
    [color=blue]
    > It's as if Javascript is turned off in Netscape. Is that an effect of
    > installing XP SP2?[/color]

    It shouldn't be. Netscape's JavaScript implementation is completely
    separate from Microsoft's. Any changes to one should have no effect on the
    other. I have SP2 and Netscape executes scripts with no problem. I assume
    you've checked for error messages?
    [color=blue]
    > How do I get Javascript to work in Netscape?[/color]

    By selecting it in the options. :P

    Seriously though, write a very small, simple test page. A lone alert will
    do. If you get nothing, consider reinstalling Netscape.

    Good luck,
    Mike


    [1] Yes that includes the mouse-over, but it won't be supported by IE so
    we'll ignore that for the time being.

    --
    Michael Winter
    Replace ".invalid" with ".uk" to reply by e-mail.

    Comment

    • Lasse Reichstein Nielsen

      #3
      Re: Javascript not working in Netscape 7.1

      Norman Swartz <swartz@sfu.c a> writes:
      [color=blue]
      > OS system is Windows XP Pro SP2.
      >
      > The following works perfectly in IE but not at all in Netscape:[/color]

      Which Netscape?
      I'll assume it's a verson 6 or later (preferably much later).
      [color=blue]
      > <tr>
      > <td valign="middle" background="dul l.gif"[/color]

      The "td" element doesn't have a "background " attribute in W3C HTML.
      It might be a proprietary Microsoft extension.

      <URL:http://www.w3.org/TR/html4/struct/tables.html#h-11.2.6>

      Remember to validate your HTML before trying to fix Javascript
      problems. Invalid HTML can cause otherwise good Javascript
      to fail (although that is not the case here).
      [color=blue]
      > onMouseOver="th is.background=' bright.gif';"[/color]

      The W3C HTML DOM doesn't have a "background " property for
      HTMLInputElemen t's either.

      <URL:http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-6043025>

      That would explain why it doesn't work as you expect in Netscape. They
      might honor the "background " HTML attribute in order to support bad
      pages, but there is a limit to how far they'll go.
      [color=blue]
      > It's as if Javascript is turned off in Netscape.[/color]

      Insert a few alerts, and it's clear that it isn't. The assignment of a
      string to the property called "background " just doesn't do anything
      except ... well, assign.
      [color=blue]
      > Is that an effect of installing XP SP2?[/color]

      Almost certainly not. The Netscape browser is not affected by patches
      to Microsoft software.
      [color=blue]
      > How do I get Javascript to work in Netscape?[/color]

      Write standards compliant code instead of just writing for IE.
      I suggest using CSS for styling and DOM-compliant Javascript:
      ---
      <td style="vertical-align: middle; background: #fff url(dull.gif)"
      onmouseover="th is.style.backgr oundImage='url( bright.gif)';"
      onmouseout="thi s.style.backgro undImage='url(d ull.gif)';">
      ...
      </td>
      ---

      /L
      --
      Lasse Reichstein Nielsen - lrn@hotpop.com
      DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
      'Faith without judgement merely degrades the spirit divine.'

      Comment

      Working...