|
| |
|
|
Tailslide
Posts: 6003 Joined: 5/10/2005 From: Out here on the raggedy edge Status: offline
|
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.
_____________________________
"My strategy is so simple an idiot could have devised it" Little Blue Plane Web Design | Blood, Sweat & Rust - A Land Rover restoration project
|
|
|
|
mar0364
Posts: 3080 Joined: 4/5/2002 From: Florida, US Status: offline
|
RE: Javascript help please - 4/15/2008 9:41:37
I use to do that in the "ASP Database" section all the time. LOL
_____________________________
Easy Web “Stay committed to your decisions, but stay flexible in your approach.”
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|