[Javascript] declare var in js file if not already declared
Peter Brunone
peter at brunone.com
Mon Dec 20 10:37:10 CST 2004
I'm not exactly sure what a Jvar is, but why don't you just declare
the value in your js and assign it in your aspx? I usually do this by
embedding an asp:Literal in a small Javascript inside my aspx file,
although you could also just build a string and then call
RegisterClientScript.
-----Original Message-----
From: javascript-bounces at LaTech.edu On Behalf Of Jessica
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/c9f18e37/attachment.htm>
More information about the Javascript
mailing list