By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,636 Members | 1,181 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,636 IT Pros & Developers. It's quick & easy.

Checkbox changed by browser after running javascript

P: n/a
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
Share this Question
Share on Google+
6 Replies


P: n/a
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

P: n/a
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

P: n/a
> 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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.