Closed Bug 18623 Opened 20 years ago Closed 20 years ago

checkbox.checked & radio.checked return false onload of document.

Categories

(Core :: DOM: Core & HTML, defect, P3, major)

x86
All
defect

Tracking

()

VERIFIED WORKSFORME

People

(Reporter: desale, Assigned: vidur)

Details

Attachments

(1 file)

checkbox.checked & radio.checked return false onload of document, even if
CHECKED attribute is specified in HTML. Once document is loaded then it starts
returning true.

BUILDS: 1999-11-11-09.

STEPS TO REPRODUCE:
1] Copy HTML code I'm providing. Save it as HTML file.
2] Open this HTML file with mozilla.exe with above specified builds.
3] As soon as you load page, you'll see one alert. Observe message on alert.
4] Click OK on this alert.
5] After loading page, you'll see one button "Show Checked". Click this button.
6] You'll see one alert. Observe message on alert.
7] Click OK on this alert.

EXPECTED RESULTS:
Both alerts should show same message [Since I'm calling same alert onLoad of
document, and onClick of button.]
It should show message like this both the times.
CheckBox Checked = true & Radio Checked = true

ACTUAL RESULTS:
First alert shows,
CheckBox Checked = false & Radio Checked = false [Which is wrong, since we are
using CHECKED attribute in HTML for checkbox as well as radio.]

Second Alert shows
CheckBox Checked = true & Radio Checked = true [Which is correct.]

TESTCASE CODE START:

<html>
<head>
<title>CheckBox and Radio</title>
</head>
<script type="text/javascript">
<!--
function showcheked(){
alert("CheckBox Checked = " + document.workform.testcbx.checked + "  &   Radio
Checked = " + document.workform.testrad.checked);
}
//-->
</script>
<body onLoad="showcheked();">
<FORM NAME="workform">
Check Box: <INPUT TYPE="checkbox" NAME="testcbx" VALUE="testvalue" CHECKED><br>
Radio:     <INPUT TYPE="radio" NAME="testrad" VALUE="testvalue" CHECKED><br>
<INPUT TYPE="button" NAME="testbut" VALUE="Show Checked"
onClick="showcheked();">
</FORM>
</body>
</html>


TESTCASE CODE END:
Works okay with the latest build. The alert message is displayed in the console
window (maybe a separate issue), but it says:

Browser Window Alert: CheckBox Checked = true  &   Radio Checked = true
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → WORKSFORME
Status: RESOLVED → VERIFIED
Verified with 12-14-09.
You need to log in before you can comment on or make changes to this bug.