<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>通过文本文档form获取值</title>
<script>
window.onload=function(){
var num=document.forms.num;
var sel=document.forms.sel;
var num1=document.forms.num1;
sel.onchange=function(){
var indexsel=this.selectedIndex+1;//获取到select里面选中的option值得索引
num1.value=indexsel*parseInt(num.value);//将选中的这个值乘上num的值,并输出结果
}
}
</script>
</head>
<body>
<form name="forms">
<input type="text" name="num" />
<select name="sel">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
</select>
<input type="text" name="num1" />
</form>
</body>
</html>