Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Examining my variable nulls it

Status
Not open for further replies.

DanWalter

Programmer
Nov 29, 2000
58
US
Hello:

There must be something I don't understand about the timing or order of parsing the javascript code and merging it back with the static HTML. I have a variable that is declared and filled in the server side code, before the HTML declarations begin. A little while down the HTML page, I have a call to server side code. After this code runs, the variable is now null!

Here is my sample code and output.

Code (in HTML page - the variable strComment1 is declared and filled by a database lookup in server side code.):

<%Response.Write("The comment is :" + strComment1 + ": and now it is :" + strComment1 +":");%>

Output:
The comment is :this is a comment: and now it is :null:

Heisenberg's uncertainty principle states that observing a phenomenon changes the phenomenon, but this is ridiculous! I have heard of these things referred to as a "Heisenbug" in programming - a bug that changes when you test it.

I can work around my specific problem - I just want to understand why this happens.

TIA,
Dan

Dan Walter
Daniel.Walter@uvm.edu
try { succeed(); } catch(E) { tryAgain(); } finally { rtfm(); }
 
Are you sure they are both spelled the same way and that you dont perhaps have a function with the same name as the variable? I mean is that the real code?
 
>A little while down the HTML page, I have a call to server side code
How?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top