javascript

A place for users and developers of the Xataface to discuss and receive support.

javascript

Postby swamarpika » Wed Sep 15, 2010 2:39 am

How would you check to see if a JavaScript variable is defined? I wrote a JavaScript program that works for the most part. Unfortunately, one of the features of the program is not responding correctly. I'm thinking that one of the variables is not defined and was wondering if anyone knew of any methods to check to see if this is the case.
___________________________
yahoo keyword tool ~ overture ~ traffic estimator ~ adwords traffic estimator
Last edited by swamarpika on Mon Sep 20, 2010 3:24 am, edited 1 time in total.
swamarpika
 
Posts: 2
Joined: Tue Sep 07, 2010 12:18 am

Re: javascript

Postby cantlep » Thu Sep 16, 2010 1:53 am

Last time I needed to check something similar with JSON and JS, I just viewed the source of the page and I could see what was created and what wasn't....You may have already tried this...but it helped me out..
cantlep
 
Posts: 172
Joined: Fri Mar 05, 2010 2:14 am

Re: javascript

Postby shannah » Fri Sep 17, 2010 11:22 am

In javascript you can use the typeof() function on your variable.
e.g.
Code: Select all
if ( typeof(myvar) == 'undefined' )  // then it is undefined
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 21 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved