JavaScript: how to keep the variable values when page posted back

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I write JavaScript for client side computing in HTML file in ASPX design.
However, I found that the variables declared in JavaScript are initialized
again when the page post back to the server. Therefore, after that, the
computation would be wrong. My question is how to keep the values of the
JavaScript variables unchange when the page postback to the server.

Thank you

David
 
You really can't, not easily anyway. You have to avoid postbacks if you want
to maintain those values.

Otherwise you would have to create hidden input controls, store values in
those, and then pull the values out after postback, and pop them back into
the javscript variables. Not too elegant.

Might be other solutions, but none of them would be trivial.
 
Thank you.
I want to add the help page to this page by clicking button.
Is there another way to add a help page which including images?

David
 
Back
Top