Go Back   PCMech Forums > Help & Discussion > Web Design / Development

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 04-29-2003, 03:57 AM   #1
Member (10 bit)
 
Join Date: Jan 2001
Location: Birmingham, UK.
Posts: 553
Send a message via Yahoo to dj4uk
Javascript Error

I'm getting a runtime error when I try to run a piece of JavaScript. The line that is causing the problem is the first line of an if statement:

if(QueryString != undefined && QueryString["date"] != undefined) {

The error states that undefined is undefined. Note this only happens in some browsers!

From some research I have found that the undefined keyword only works for some browsers has anyone got any more info on this e.g. which browsers it will work for? Can anyone come up with a workaround so that I can check if variables are undefined.

Help appreciated.

DJ
dj4uk is offline   Reply With Quote
Old 04-29-2003, 06:10 AM   #2
Member (7 bit)
 
chris1977uk's Avatar
 
Join Date: Sep 2002
Location: Middlesbrough, UK
Posts: 108
define

my guess would be do one of two things.

1) define undefined
2) if u r comparing 2 strings, shouldnt they be in quotes (i know this is the case in ASP, not sure about javascript)
chris1977uk is offline   Reply With Quote
Old 04-29-2003, 06:13 AM   #3
Member (10 bit)
 
Join Date: Jan 2001
Location: Birmingham, UK.
Posts: 553
Send a message via Yahoo to dj4uk
1. undefined means undefined so it can't be defined!
2. I am not comparing two strings - I am checking if a variable is defined.

Anyway I have found a solution to this:

if(QueryString && QueryString["date"]) {

Does the job!
dj4uk is offline   Reply With Quote
Old 04-29-2003, 06:17 AM   #4
Member (7 bit)
 
chris1977uk's Avatar
 
Join Date: Sep 2002
Location: Middlesbrough, UK
Posts: 108
AH!

ah i see, i think i misunderstood the prob!!

still early over here lol !
chris1977uk is offline   Reply With Quote
Old 04-29-2003, 06:19 AM   #5
Member (10 bit)
 
Join Date: Jan 2001
Location: Birmingham, UK.
Posts: 553
Send a message via Yahoo to dj4uk
Didn't realise there was that much of a time delay between Brum and Middlesbrough.
dj4uk is offline   Reply With Quote
Old 04-29-2003, 06:21 AM   #6
Member (7 bit)
 
chris1977uk's Avatar
 
Join Date: Sep 2002
Location: Middlesbrough, UK
Posts: 108
LOL depends when u get out of bed!
chris1977uk is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 07:58 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2