|
Tailslide -> Javascript help please (4/15/2008 8:50:17)
|
Hi all I've run into a Javascript problem and I've confused myself (happens a lot!). I'm hoping someone out there can point me in the right direction. I'm using this script to show/hide a ton of form fields depending on whether a checkbox is checked: <script type="text/javascript">
function toggle() {
if (document.getElementById) {
if (document.getElementById("person_subscription_birthday_club").checked == true) {
document.getElementById("birthdayclub").style.display = "block";
} else {
document.getElementById("birthdayclub").style.display = "none";
}
}
}
</script> With this: onclick="toggle();" in the checkbox input itself. All fine and dandy - works very nicely thank you. The problem is on the otherwise identical - update profile form, I want to check onload if the checkbox in question is already checked and either show or hide the rest of the stuff accordingly. Then also have the current functionality.
|
|
|
|