470,644 Members | 1,232 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,644 developers. It's quick & easy.

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 1597
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Steph | last post: by
1 post views Thread by mschoup | last post: by
34 posts views Thread by clinttoris | last post: by
6 posts views Thread by Daz | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.