473,406 Members | 2,633 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Checkbox changed by browser after running javascript

I have a form with a checkbox. Using MSIE, the user marks the checkbox,
submits the form and gets his result. Then he uses the browsers back
button to return to the form.

Here I have a
checkbox=document.getElementById('ch1');
alert(checkbox.status);

This alert pops up and says "false". I can see that the checkbox is not
activated. Then I click "ok" to the alert and then the checkbox is
checked. I.e. the browser fills in the previous values _after_
javascript processing is done.
How can I determine the checkbox status with javascript?

JMS

Oct 12 '05 #1
6 1698
Nn**********@spammotel.com wrote:
I have a form with a checkbox. Using MSIE, the user marks the checkbox,
submits the form and gets his result. Then he uses the browsers back
button to return to the form.

Here I have a
checkbox=document.getElementById('ch1');
alert(checkbox.status);

This alert pops up and says "false".
When do you activate the above script - onload? in a script element in
the page?
I can see that the checkbox is not activated. Then I click "ok" to the alert and then the checkbox is
checked. I.e. the browser fills in the previous values _after_
javascript processing is done.
How can I determine the checkbox status with javascript?


When - onload? during load?
--
Rob
Oct 12 '05 #2
Nn**********@spammotel.com escribió:
I have a form with a checkbox. Using MSIE, the user marks the checkbox,
submits the form and gets his result. Then he uses the browsers back
button to return to the form.

Here I have a
checkbox=document.getElementById('ch1');
alert(checkbox.status);

This alert pops up and says "false". I can see that the checkbox is not
activated. Then I click "ok" to the alert and then the checkbox is
checked. I.e. the browser fills in the previous values _after_
javascript processing is done.
How can I determine the checkbox status with javascript?

JMS


I didn't ever hear about a "status" property. Why don't you use "checked"?

Andrew [ knocte ]

--
Oct 12 '05 #3
> When do you activate the above script - onload? in a script element in
the page?


Of course I don't check it onload, the script is inside the page
between </body> and </html>

JMS

Oct 12 '05 #4
Nn**********@spammotel.com wrote:
When do you activate the above script - onload? in a script element in
the page?

Of course I don't check it onload,


Why not? It will likely fix your problem.

the script is inside the page
between </body> and </html>


That is invalid markup, an HTML element can only contain head and body
elements:

<!ENTITY % html.content "HEAD, BODY">

<URL:http://www.w3.org/TR/html4/struct/global.html#edef-HTML>
If the browser stumbles across a script element as a child of the HTML
element, you are at the mercy of error correction.
--
Rob
Oct 12 '05 #5
I didn't ever hear about a "status" property. Why don't you use "checked"?


I think it's not important what I use. When the alert pops up, the
checkbox is not checked. The browser fills the check mark after the
script ran.

JMS

Oct 14 '05 #6
Lee
Nn**********@spammotel.com said:
When do you activate the above script - onload? in a script element in
the page?


Of course I don't check it onload, the script is inside the page
between </body> and </html>


Judging by the fact that "of course I don't" is not a reasonable answer,
I'm guessing that you don't understand that "onload" means using the
body's onLoad event handler, so that the code is executed after the page
has completely loaded.

Code appearing after the body is invalid HTML.

Oct 14 '05 #7

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

Similar topics

4
by: Steph | last post by:
Hello, Can someone tell me the script to use for having a change on the same page when using checkbox function ? For example, i would to check one condition and display dynamically a button...
5
by: Leo J. Hart IV | last post by:
Hello, I'm hoping someone can help me out. I was wondering if the Enabled property of a CheckBox or RadioButton server control is stored in the ViewState. If not, is there some way to to add...
5
by: tshad | last post by:
Is there a way to allow a user to press a radio button if it is already selected? There is an onCheckedChanged event that fires when the person presses the button and it is isn't selected...
1
by: mschoup | last post by:
I have a simple aspx page(WebForm1.aspx) with a HyperLink, LinkButton, and two CheckBoxes. When I select a CheckBox and then click the LinkButton, the CheckBox retains state. When I select the...
34
by: clinttoris | last post by:
Hello Experts, I have been told to post this in the Javascript forum as I want to do this client side just before my form gets submitted. Once the user clicks the submit button a javascript...
6
by: Daz | last post by:
Hi everyone. Firstly, I apologise if this i not what you would call a PHP problem. I get quite confused as to what lives in which realm, so if this shouldn't be posted here, please suggest where...
10
by: rn5a | last post by:
All the rows in a DataGrid, including the Header, are accompanied with a CheckBox. I want that when the CheckBox in the Header is checked, then all the CheckBoxes should automatically get checked....
4
by: mamun | last post by:
Hi All, I have the following situation and am looking for answer in C#. I have a datagrid and putting checkbox next to each record. In the header I have a Delete button. I want users to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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,...
0
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...

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.