当我选择单选按钮时,其他功能将启用文本框,并且我想从中读取值
function calculate() {
var currency = parseFloat(0);
var message = "";
currency = document.getElementsByName("val")[0].value;
message = ("You Have Entered Amount : " + currency);
document.getElementById("result").innerHTML = message;
}
<td>
<input type="radio" name="inputControl" value="1" onchange="setvisible(this.value)"> Euro
</td>
<td><input type="number" name="val" size="10" id="set1" style="visibility:hidden;">
</td>
答案 0 :(得分:1)
删除[0] .value部分。试试这个
currency = document.getElementsByName(“ val”)