Forum Moderators: open
You'll need to use :-
document.getElementById() to locate the element to hide/show.
element.style.display='' to show the element.
element.style.display='none' to hide the element.
You'll also need to establish the radiobutton status. I can't remember how you do that, but maybe there is a property called checked.
Kaled.
So this is my small form
<form action="insert.php">
<input type="radio" name="developer"/><br>
<input type="radio" name="developer"/><br>
<input type="submit" value="submit"/>
</form>
This is the text box I would like shown if one radio is clicked.
<input type="text" name="dev1"/>
And this is the select statement I would like to be shown if the other is clicked.
<select name="dev1"><option value="Widget">Widget</option><option value="Widget 2">Widget 2</option></select>
Can someone help me put this together?
Thank you so much, Dylan
maybe this is what you are lookin for...
<script language=javascript>
function make_text(zz) {
document.getElementById(zz).innerHTML = '<select name="dev1">'+
'<option value="Widget">Widget</option><option value="Widget 2">Widget 2</option></select>';
}
function make_select(zz) {
document.getElementById(zz).innerHTML = '<input type="text" name="dev1">';
}
</script>
<form action="insert.php">
<input type="radio" name="developer" value="uniform" onClick="make_select('dd');">
<input type="radio" name="developer" value="custom" onClick="make_text('dd');">
<div id=dd></div><input type="submit" value="submit">
</form>