【发布时间】:2016-01-30 16:55:27
【问题描述】:
我有一组带有“其他”选项的无线电输入,该选项有一个文本字段。我的问题是如何在选择其他选项时进行文本字段。
到目前为止我想出的代码::
<form method="POST" action="testPage.php">
<input type="radio" name="option" value="1">Option 1<br>
<input type="radio" name="option" value="2">Option 2<br>
<input type="radio" name="option" value="3">Option 3<br>
<input type="radio" name="option" value="">Other
<input type="text" name="othertext" onchange="changeradioother()">
<input type="submit" value="Submit">
</form>
<script>
function changeradioother(){
var other= document.getElementById("other");
other.value=document.getElementById("inputother").value;
}
</script>
【问题讨论】:
标签: javascript html forms radio-button