Problem with JScript in Internet Explorer

Discussion in 'Javascript' started by netsurfer, Apr 23, 2005.

  1. netsurfer

    netsurfer Guest

    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=MSFPpreload("_derived/dock pick up.gif");
    MSFPnav2h=MSFPpreload("_derived/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.
     
    netsurfer, Apr 23, 2005
    #1
    1. Advertising

  2. netsurfer

    Mick White Guest

    netsurfer wrote:

    > 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


    Look for the following abomination:

    MSFPhover =
    (((navigator.appName == "Netscape") &&
    (parseInt(navigator.appVersion) >= 3 )) ||
    ((navigator.appName == "Microsoft Internet Explorer") &&
    (parseInt(navigator.appVersion) >= 4 )));

    Change it to, or add:

    MSFPhover = document.images?true:false;

    Mick





    >
    > When I run the debugger it points to this line of code:
    >
    > if(MSFPhover) { MSFPnav2n=MSFPpreload("_derived/dock pick up.gif");
    > MSFPnav2h=MSFPpreload("_derived/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, Apr 23, 2005
    #2
    1. Advertising

  3. netsurfer

    Evertjan. Guest

    Mick White wrote on 23 apr 2005 in comp.lang.javascript:

    > Look for the following abomination:
    >
    > MSFPhover =
    > (((navigator.appName == "Netscape") &&
    > (parseInt(navigator.appVersion) >= 3 )) ||
    > ((navigator.appName == "Microsoft Internet Explorer") &&
    > (parseInt(navigator.appVersion) >= 4 )));
    >
    > Change it to, or add:
    >
    > MSFPhover = document.images?true:false;
    >


    And change that to:

    MSFPhover = !!document.images

    ;-}

    --
    Evertjan.
    The Netherlands.
    (Replace all crosses with dots in my emailaddress)
     
    Evertjan., Apr 23, 2005
    #3
  4. netsurfer

    Mick White Guest

    Evertjan. wrote:

    > Mick White wrote
    >>MSFPhover = document.images?true:false;

    > And change that to:
    >
    > MSFPhover = !!document.images
    >
    > ;-}



    Yes, but I didn't want to give out cryptic advice...
    Mick
     
    Mick White, Apr 24, 2005
    #4
  5. Mick White wrote:
    > Evertjan. wrote:
    >
    >> Mick White wrote
    >>>MSFPhover = document.images?true:false;

    > > And change that to:
    >>
    >> MSFPhover = !!document.images
    >>

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


    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(document.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.
     
    Richard Cornford, Apr 24, 2005
    #5
  6. netsurfer

    Mick White Guest

    Richard Cornford wrote:

    >>
    >>>Mick White wrote
    >>>
    >>>>MSFPhover = document.images?true:false;

    >>
    >> > And change that to:

    >>
    >>>MSFPhover = !!document.images
    >>>

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

    [...]
    >
    > But if you want to write that statement in a way that is theoretically
    > unambiguous:-
    >
    > MSFPhover = Boolean(document.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.


    I doubt,in this case, that the OP would recognize "MSFPhover =
    !!document.images" 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
     
    Mick White, Apr 24, 2005
    #6
  7. netsurfer

    Evertjan. Guest

    Mick White wrote on 24 apr 2005 in comp.lang.javascript:

    > Evertjan. wrote:
    >
    >> Mick White wrote
    >>>MSFPhover = document.images?true:false;

    > > And change that to:
    >>
    >> MSFPhover = !!document.images
    >>
    >> ;-}

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


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

    --
    Evertjan.
    The Netherlands.
    (Replace all crosses with dots in my emailaddress)
     
    Evertjan., Apr 24, 2005
    #7
  8. netsurfer

    Mick White Guest

    Evertjan. wrote:

    > Mick White wrote on 24 apr 2005 in comp.lang.javascript:
    >
    >
    >>Evertjan. wrote:
    >>
    >>
    >>>Mick White wrote
    >>>
    >>>>MSFPhover = document.images?true:false;

    >>
    >> > And change that to:

    >>
    >>>MSFPhover = !!document.images
    >>>
    >>>;-}

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

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


    !false
    Mick




    >
     
    Mick White, Apr 24, 2005
    #8
    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. cmay
    Replies:
    0
    Views:
    1,172
  2. Andy
    Replies:
    0
    Views:
    551
  3. Ed Hauptman
    Replies:
    7
    Views:
    1,091
    Ed Hauptman
    Aug 7, 2009
  4. John Smith
    Replies:
    1
    Views:
    167
    Evertjan.
    Mar 12, 2005
  5. VK
    Replies:
    12
    Views:
    228
    Ivan Marsh
    Apr 2, 2007
Loading...

Share This Page