Problem with JScript in Internet Explorer

N

netsurfer

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.
 
M

Mick White

netsurfer said:
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
 
E

Evertjan.

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

;-}
 
R

Richard Cornford

Mick said:
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.
 
M

Mick White

Richard said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,023
Latest member
websitedesig25

Latest Threads

Top