Problem with JScript in Internet Explorer

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

    #1

    Problem with JScript in Internet Explorer

    Hi:

    I'm having an issue with a website design that I'm working on a web
    page...and I'm coming up
    with an Error after opening the web site Internet Explorer browser that
    says:

    Error

    A Runtime Error has occurred. Do you wish to Debug?

    Line: 413
    Error: 'MSFPhover' is undefined

    When I run the debugger it points to this line of code:

    if(MSFPhover) { MSFPnav2n=MSFPp reload("_derive d/dock pick up.gif");
    MSFPnav2h=MSFPp reload("_derive d/dock pick up_a.gif"); }

    I'm not really sure how MSFPhover would be defined. Would really
    appreciate any feedback on how this can go about being
    done.

    Thanks in advanced for any response.

  • Mick White

    #2
    Re: Problem with JScript in Internet Explorer

    netsurfer wrote:
    [color=blue]
    > Hi:
    >
    > I'm having an issue with a website design that I'm working on a web
    > page...and I'm coming up
    > with an Error after opening the web site Internet Explorer browser that
    > says:
    >
    > Error
    >
    > A Runtime Error has occurred. Do you wish to Debug?
    >
    > Line: 413
    > Error: 'MSFPhover' is undefined[/color]

    Look for the following abomination:

    MSFPhover =
    (((navigator.ap pName == "Netscape") &&
    (parseInt(navig ator.appVersion ) >= 3 )) ||
    ((navigator.app Name == "Microsoft Internet Explorer") &&
    (parseInt(navig ator.appVersion ) >= 4 )));

    Change it to, or add:

    MSFPhover = document.images ?true:false;

    Mick




    [color=blue]
    >
    > When I run the debugger it points to this line of code:
    >
    > if(MSFPhover) { MSFPnav2n=MSFPp reload("_derive d/dock pick up.gif");
    > MSFPnav2h=MSFPp reload("_derive d/dock pick up_a.gif"); }
    >
    > I'm not really sure how MSFPhover would be defined. Would really
    > appreciate any feedback on how this can go about being
    > done.
    >
    > Thanks in advanced for any response.
    >[/color]

    Comment

    • Evertjan.

      #3
      Re: Problem with JScript in Internet Explorer

      Mick White wrote on 23 apr 2005 in comp.lang.javas cript:
      [color=blue]
      > Look for the following abomination:
      >
      > MSFPhover =
      > (((navigator.ap pName == "Netscape") &&
      > (parseInt(navig ator.appVersion ) >= 3 )) ||
      > ((navigator.app Name == "Microsoft Internet Explorer") &&
      > (parseInt(navig ator.appVersion ) >= 4 )));
      >
      > Change it to, or add:
      >
      > MSFPhover = document.images ?true:false;
      >[/color]

      And change that to:

      MSFPhover = !!document.imag es

      ;-}

      --
      Evertjan.
      The Netherlands.
      (Replace all crosses with dots in my emailaddress)

      Comment

      • Mick White

        #4
        Re: Problem with JScript in Internet Explorer

        Evertjan. wrote:
        [color=blue]
        > Mick White wrote[color=green]
        >>MSFPhover = document.images ?true:false;[/color]
        > And change that to:
        >
        > MSFPhover = !!document.imag es
        >
        > ;-}[/color]


        Yes, but I didn't want to give out cryptic advice...
        Mick

        Comment

        • Richard Cornford

          #5
          Re: Problem with JScript in Internet Explorer

          Mick White wrote:[color=blue]
          > Evertjan. wrote:
          >[color=green]
          >> Mick White wrote[color=darkred]
          >>>MSFPhover = document.images ?true:false;[/color]
          > > And change that to:
          >>
          >> MSFPhover = !!document.imag es
          >>[/color]
          > Yes, but I didn't want to give out cryptic advice...[/color]

          Cryptic to who? Shouldn't javascript programmers be expected to
          understand the language's operators, and the implied type-conversions in
          the above statement?

          But if you want to write that statement in a way that is theoretically
          unambiguous:-

          MSFPhover = Boolean(documen t.images);

          - should be sufficiently self-documenting. Though the reader is still
          expected to understand the actions of the Boolean constructor when
          called as a function.

          Though, given the reported error, the OP's problem looks more related to
          a failure to declare the variable in the global namespace. But the
          information provided is inadequate for a meaningful analyses.

          Richard.


          Comment

          • Mick White

            #6
            Re: Problem with JScript in Internet Explorer

            Richard Cornford wrote:
            [color=blue][color=green]
            >>[color=darkred]
            >>>Mick White wrote
            >>>
            >>>>MSFPhover = document.images ?true:false;[/color]
            >>[color=darkred]
            >> > And change that to:[/color]
            >>[color=darkred]
            >>>MSFPhover = !!document.imag es
            >>>[/color]
            >>
            >>Yes, but I didn't want to give out cryptic advice...[/color][/color]
            [...][color=blue]
            >
            > But if you want to write that statement in a way that is theoretically
            > unambiguous:-
            >
            > MSFPhover = Boolean(documen t.images);
            >
            > - should be sufficiently self-documenting. Though the reader is still
            > expected to understand the actions of the Boolean constructor when
            > called as a function.[/color]

            I doubt,in this case, that the OP would recognize "MSFPhover =
            !!document.imag es" as being implied type casting (to Boolean), I simply
            offered a more "readable" solution. I do like the Boolean constructor,
            though; it's certainly less cryptic.
            Mick

            Comment

            • Evertjan.

              #7
              Re: Problem with JScript in Internet Explorer

              Mick White wrote on 24 apr 2005 in comp.lang.javas cript:
              [color=blue]
              > Evertjan. wrote:
              >[color=green]
              >> Mick White wrote[color=darkred]
              >>>MSFPhover = document.images ?true:false;[/color]
              > > And change that to:
              >>
              >> MSFPhover = !!document.imag es
              >>
              >> ;-}[/color]
              >
              >
              > Yes, but I didn't want to give out cryptic advice...
              > Mick
              >[/color]

              true ..... false .... ;-)

              --
              Evertjan.
              The Netherlands.
              (Replace all crosses with dots in my emailaddress)

              Comment

              • Mick White

                #8
                Re: Problem with JScript in Internet Explorer

                Evertjan. wrote:
                [color=blue]
                > Mick White wrote on 24 apr 2005 in comp.lang.javas cript:
                >
                >[color=green]
                >>Evertjan. wrote:
                >>
                >>[color=darkred]
                >>>Mick White wrote
                >>>
                >>>>MSFPhover = document.images ?true:false;[/color]
                >>[color=darkred]
                >> > And change that to:[/color]
                >>[color=darkred]
                >>>MSFPhover = !!document.imag es
                >>>
                >>>;-}[/color]
                >>
                >>
                >>Yes, but I didn't want to give out cryptic advice...
                >>Mick
                >>[/color]
                >
                >
                > true ..... false .... ;-)[/color]

                !false
                Mick



                [color=blue]
                >[/color]

                Comment

                Working...