Changing a page instantly
I hope this is the right place for this question, but I was wondering how I could make a page do this:
I have a check box on my page (name = multiple) and what I want to do is when a person clicks it have it add extra input fields or remove them if unchecked. I have no idea how to go about this, I'm thinkin' it would be Java Script, but I'm not exactly sure.
If I confused you, sorry. If not, please try and help!
thanks,
james
[James Logsdon]
kb posted this at 15:18 — 21st September 2002.
He has: 1,380 posts
Joined: Feb 2002
check hotscripts.com and resourceindex.com
i believe you CAN do that with JS
ROB posted this at 16:01 — 21st September 2002.
They have: 447 posts
Joined: Oct 1999
this should work:
<form name="myform">
<br><input type="checkbox" onclick="document.getElementById('myhiddenfields').style.display = (this.checked) ? '' : 'none'"> check me!
<br><input type="text" name="myfield1">
<br><input type="text" name="myfield2">
<span id="myhiddenfields" style="display:none">
<br><input type="text" name="myfield3">
<br><input type="text" name="myfield4">
</span>
</form>
necrotic posted this at 16:44 — 21st September 2002.
He has: 296 posts
Joined: May 2002
YAY! You guys are awesome. It works great. Thanks ROB and Eskater05.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.