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

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
 
M

Marina Levit [MVP]

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.
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,810
Latest member
Kassie0918

Latest Threads

Top