[Javascript] declare var in js file if not already declared

Jessica Jessica at greenlight.co.uk
Mon Dec 20 10:27:47 CST 2004


Hi,

 

Im calling a js file from my aspx pages.

In the aspx page I set a Jvar.

In the js file, I read the Jvar field.

Some aspx page does not have the Jvar set.

This returns an object not found error, cos it's looking 4 the Jvar in
the aspx file.

How do I code in my js file to bypass this error if there's no Jvar in
my aspx file.

 

js file contents:

var TrackValue = Jvar;

document.write('<IMG id=test name=test src=https://test.gif?x=' +
(TrackValue)   + ' /><br>' ); 

 

thanks

jess

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20041220/51fda939/attachment.htm>


More information about the Javascript mailing list