473,467 Members | 2,008 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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

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
Mar 31 '06 #1
2 2295
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.

"david" <da***@discussions.microsoft.com> wrote in message
news:DD**********************************@microsof t.com...
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

Mar 31 '06 #2
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

"Marina Levit [MVP]" wrote:
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.

"david" <da***@discussions.microsoft.com> wrote in message
news:DD**********************************@microsof t.com...
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


Mar 31 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.