b_hole
11-01-2006, 09:24 PM
I have this simple function:
function SH() {
if (document.getElementById("isID")) {
document.getElementById("isID").style.display="none";
document.getElementById("mycheckbox").onchange=function() {
document.getElementById("isID").style.display=(this.checked)?"block":"none";
}
}
}That works on Firefox, but in MSIE not: is seems as if IE gets "onchange" for the checkbox only if its value is true and only if the user clicked on the LABEL of the checkbox. Also, if the user clicks the checkbox itself that function don't work at all.
Why?
function SH() {
if (document.getElementById("isID")) {
document.getElementById("isID").style.display="none";
document.getElementById("mycheckbox").onchange=function() {
document.getElementById("isID").style.display=(this.checked)?"block":"none";
}
}
}That works on Firefox, but in MSIE not: is seems as if IE gets "onchange" for the checkbox only if its value is true and only if the user clicked on the LABEL of the checkbox. Also, if the user clicks the checkbox itself that function don't work at all.
Why?