打扰一下
我最近在学javascript
看网络教学后综合做了一个select和radio有加减的函式
但一直没成功
也找不到错在哪里
请大大们指点指点
大意为checked*selected+input1输入之数值=输出到input2
以下为程式码
<html>
<head>
<title></title>
<script>
function _click(theform){
var rl = theform._radio.length;
var sl = theform._select.option.length;
for(var i=0;i<rl;i++)
{
if(theform.radio[i].checked)
{
var rv = theform._radio[i].value;
}
}//radio
for(var i=0;i<sl;i++)
{
if(theform._select.option[i].selected)
{
var sv = theform._select.option[i].value;
}
}//select
var inpva = parseInt(document.getElementById("_input1").value;)
var aaaa= parseInt(sv*rv);
document.getElementById("_input2").value= aaaa+inpva ;
}
</script>
</head>
<body>
<form>
<input type="radio" name="_radio" value="10">10</input>
<input type="radio" name="_radio" value="20">20</input>
<select name="_select">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
<input type="text" name="_input1" id="_input1">
<button type="reset" value="">清除</button>
<button onclick="_click(this.form)">=</button>
<input type="text" readonly="true" name="_input2" id="_input2">
</form>
</body>
</html>