Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Javascript (http://www.velocityreviews.com/forums/f68-javascript.html)
-   -   Problem with JScript in Internet Explorer (http://www.velocityreviews.com/forums/t917736-problem-with-jscript-in-internet-explorer.html)

netsurfer 04-23-2005 06:11 PM

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=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 04-23-2005 06:30 PM

Re: Problem with JScript in Internet Explorer
 
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.
>


Evertjan. 04-23-2005 08:02 PM

Re: Problem with JScript in Internet Explorer
 
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)


Mick White 04-23-2005 11:13 PM

Re: Problem with JScript in Internet Explorer
 
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


Richard Cornford 04-24-2005 12:47 AM

Re: Problem with JScript in Internet Explorer
 
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.



Mick White 04-24-2005 02:49 AM

Re: Problem with JScript in Internet Explorer
 
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

Evertjan. 04-24-2005 03:46 PM

Re: Problem with JScript in Internet Explorer
 
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)


Mick White 04-24-2005 06:16 PM

Re: Problem with JScript in Internet Explorer
 
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




>



All times are GMT. The time now is 11:54 PM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57