Function being ignored in NN4

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Stephen Poley

    Function being ignored in NN4

    Apologies if this is a silly question, but Googling on the archive
    didn't produce any answers.

    I have a piece of inline Javascript which works as expected in IE 6,
    Opera 7, Mozilla and NN 4. In the interests of keeping my pieces of
    script together, I changed it into a function and called it thus:

    <SCRIPT type="text/javascript">
    buttonbar();
    </SCRIPT>

    This works fine in IE, Opera and Mozilla, but NN 4 does not call the
    function. Could anyone suggest why?

    The page is validated HTML 4.01. (And before you ask: I do have a
    corresponding <NOSCRIPT> element as well.)

    --
    Stephen Poley
    Barendrecht, Holland
  • Martin Honnen

    #2
    Re: Function being ignored in NN4



    Stephen Poley wrote:[color=blue]
    > Apologies if this is a silly question, but Googling on the archive
    > didn't produce any answers.
    >
    > I have a piece of inline Javascript which works as expected in IE 6,
    > Opera 7, Mozilla and NN 4. In the interests of keeping my pieces of
    > script together, I changed it into a function and called it thus:
    >
    > <SCRIPT type="text/javascript">
    > buttonbar();
    > </SCRIPT>
    >
    > This works fine in IE, Opera and Mozilla, but NN 4 does not call the
    > function. Could anyone suggest why?
    >
    > The page is validated HTML 4.01. (And before you ask: I do have a
    > corresponding <NOSCRIPT> element as well.)[/color]

    What does the JavaScript console in NN4 show?
    Type
    javascript:<ret urn>
    in the location bar and check for error messages

    --

    Martin Honnen


    Comment

    • Stephen Poley

      #3
      Re: Function being ignored in NN4

      On Wed, 02 Jul 2003 14:04:38 +0200, Martin Honnen
      <Martin.Honnen@ t-online.de> wrote:
      [color=blue]
      >Stephen Poley wrote:[color=green]
      >> Apologies if this is a silly question, but Googling on the archive
      >> didn't produce any answers.
      >>
      >> I have a piece of inline Javascript which works as expected in IE 6,
      >> Opera 7, Mozilla and NN 4. In the interests of keeping my pieces of
      >> script together, I changed it into a function and called it thus:
      >>
      >> <SCRIPT type="text/javascript">
      >> buttonbar();
      >> </SCRIPT>
      >>
      >> This works fine in IE, Opera and Mozilla, but NN 4 does not call the
      >> function. Could anyone suggest why?
      >>
      >> The page is validated HTML 4.01. (And before you ask: I do have a
      >> corresponding <NOSCRIPT> element as well.)[/color][/color]
      [color=blue]
      >What does the JavaScript console in NN4 show?
      >Type
      > javascript:<ret urn>
      >in the location bar and check for error messages[/color]


      It says:
      ----
      JavaScript Error:
      file:/C|/!Website/Development/webmatters/resize.html, line
      52: invalid case expression JavaScript Error:
      file:/C|/!Website/Development/webmatters/resize.html, line
      192:

      buttonbar is not defined.
      ----

      Line 52 is in a function close to the top of my Javascript and should
      not have been called on initial display, so I assume that NN4 starts
      there for some reason when it can't find buttonbar.

      Or, musing further, perhaps NN4 can't parse this and the error recovery
      stops it from finding buttonbar. The statement is as follows. Line 52 is
      'case small'. Is there something here that NN4 doesn't like?

      switch(imgsize) {
      case small: imgwidth=smaWid th; imgheight=smaHe ight; imgid='1';
      break;
      case medium: imgwidth=medWid th; imgheight=medHe ight; imgid='2';
      break;
      case large: imgwidth=larWid th; imgheight=larHe ight; imgid='3';
      break;
      default: alert('Javascri pt error 1; please shoot the author');
      }


      --
      Stephen Poley
      Barendrecht, Holland

      Comment

      • Laurent Bugnion, GalaSoft

        #4
        Re: Function being ignored in NN4

        Hi,

        Stephen Poley wrote:[color=blue]
        > On Wed, 02 Jul 2003 14:04:38 +0200, Martin Honnen
        > <Martin.Honnen@ t-online.de> wrote:
        >
        >[color=green]
        >>Stephen Poley wrote:
        >>[color=darkred]
        >>>Apologies if this is a silly question, but Googling on the archive
        >>>didn't produce any answers.
        >>>
        >>>I have a piece of inline Javascript which works as expected in IE 6,
        >>>Opera 7, Mozilla and NN 4. In the interests of keeping my pieces of
        >>>script together, I changed it into a function and called it thus:
        >>>
        >>><SCRIPT type="text/javascript">
        >>> buttonbar();
        >>></SCRIPT>
        >>>
        >>>This works fine in IE, Opera and Mozilla, but NN 4 does not call the
        >>>function. Could anyone suggest why?
        >>>
        >>>The page is validated HTML 4.01. (And before you ask: I do have a
        >>>correspondin g <NOSCRIPT> element as well.)[/color]
        >>[/color]
        >[color=green]
        >>What does the JavaScript console in NN4 show?
        >>Type
        >> javascript:<ret urn>
        >>in the location bar and check for error messages[/color]
        >
        >
        >
        > It says:
        > ----
        > JavaScript Error:
        > file:/C|/!Website/Development/webmatters/resize.html, line
        > 52: invalid case expression JavaScript Error:
        > file:/C|/!Website/Development/webmatters/resize.html, line
        > 192:
        >
        > buttonbar is not defined.
        > ----
        >
        > Line 52 is in a function close to the top of my Javascript and should
        > not have been called on initial display, so I assume that NN4 starts
        > there for some reason when it can't find buttonbar.
        >
        > Or, musing further, perhaps NN4 can't parse this and the error recovery
        > stops it from finding buttonbar. The statement is as follows. Line 52 is
        > 'case small'. Is there something here that NN4 doesn't like?
        >
        > switch(imgsize) {
        > case small: imgwidth=smaWid th; imgheight=smaHe ight; imgid='1';
        > break;
        > case medium: imgwidth=medWid th; imgheight=medHe ight; imgid='2';
        > break;
        > case large: imgwidth=larWid th; imgheight=larHe ight; imgid='3';
        > break;
        > default: alert('Javascri pt error 1; please shoot the author');
        > }
        >
        >[/color]

        I recently found out that Netscape 4 chokes on case labels which are
        defined somewhere else in the code. Pretty boring (if you really *have*
        to use Netscape 4), since it prevents you to use (pseudo-)constants as
        case labels. What seems to happens is that Netscape 4 parses the
        switch..case part before it parses the place where the
        (pseudo-)constants are defined. Changing the order of the definitions in
        the script didn't change the problem. Replacing the case label with
        numerals did solve the problem, but is not satisfying from a
        programmer's POV.

        This and other reasons convinced me to definitely drop Netscape 4 as a
        development tool and to use Mozilla/Venkman to develop. My target is now
        Netscape 7 / IE5+ and I will give only the simplest version of my sites
        to Netscape 4 users, as well as a request to upgrade.

        This problem doesn't happen on Mozilla/Netscape 7.

        HTH,

        Laurent
        --
        Laurent Bugnion, GalaSoft
        Webdesign, Java, JavaScript: http://www.galasoft-LB.ch
        Private/Malaysia: http://mypage.bluewin.ch/lbugnion
        Support children in Calcutta: http://www.calcutta-espoir.ch

        Comment

        • Stephen Poley

          #5
          Re: Function being ignored in NN4

          On Thu, 03 Jul 2003 07:01:45 +0200, "Laurent Bugnion, GalaSoft"
          <galasoft-LB@bluewin_NO_S PAM.ch> wrote:
          [color=blue]
          >I recently found out that Netscape 4 chokes on case labels which are
          >defined somewhere else in the code. Pretty boring (if you really *have*
          >to use Netscape 4), since it prevents you to use (pseudo-)constants as
          >case labels. What seems to happens is that Netscape 4 parses the
          >switch..case part before it parses the place where the
          >(pseudo-)constants are defined.[/color]

          Thank you very much - that did indeed turn out to be the problem.
          [color=blue]
          >Changing the order of the definitions in
          >the script didn't change the problem. Replacing the case label with
          >numerals did solve the problem, but is not satisfying from a
          >programmer's POV.[/color]

          Agreed. Actually all I need to do in Netscape 4 is explain to the reader
          that the specific function concerned is unavailable. So I managed to fix
          it by putting the buttonbar() function in a separate <SCRIPT> element,
          immediately after the element containing the case statement. The script
          is at least together in the <HEAD>, which is what I wanted.
          [color=blue]
          >This and other reasons convinced me to definitely drop Netscape 4 as a
          >development tool and to use Mozilla/Venkman to develop. My target is now
          >Netscape 7 / IE5+ and I will give only the simplest version of my sites
          >to Netscape 4 users, as well as a request to upgrade.[/color]

          I mainly use Opera, and also test the results in Mozilla and IE. If I
          get into doing a lot of Javascript, I'll probably use Mozilla more.
          Netscape 4 is, as you imply, mainly a damage-limitation exercise, but I
          do still get about 3%-4% NN4 visitors, so I'm not abandoning them just
          yet.

          --
          Stephen Poley
          Barendrecht, Holland

          Comment

          Working...