469,883 Members | 1,232 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,883 developers. It's quick & easy.

Textbox appearing after radio button is selected

19
Im trying to write a java script in HTML in which when a particular radio button is selected, a textbox would appear write next to the selected item. e.g

(RADIO BUTTON) fhd: [if this radio button is selected, textbox will appear here]
(RADIO BUTTON) fdj:
(RADIO BUTTON) djs:
(RADIO BUTTON) hfjd:

Can anyone please help me..

Thanks
Dec 7 '06 #1
1 2703
ronverdonk
4,258 Expert 4TB
Try this out:[html]<html><head>
<script type="text/javascript">
function Markit(name) {
if (name == 1) {
document.getElementById("id1").innerHTML = '<textarea rows="3" cols="30">Here your text for box 1</textarea>';
document.getElementById("id2").innerHTML = ' ';
}
if (name == 2) {
document.getElementById("id1").innerHTML = ' ';
document.getElementById("id2").innerHTML = '<textarea rows="1" cols="40">Here your text for box 2</textarea>';
}
}
</script>
</head>
<body>
<br /><input onclick='Markit(1)' type="radio" name="a" value="y" /><div id='id1'></div>
<br /><input onclick='Markit(2)' type="radio" name="a" value="n" /><div id='id2'></div>

</body></html>[/html]Ronald :cool:
Dec 8 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Oscar Monteiro | last post: by
5 posts views Thread by Digital Puer | last post: by
2 posts views Thread by teddy.am | last post: by
3 posts views Thread by Harry Haller | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.