<!DOCTYPE html>
<html>
<head>
<title> 事件</title>
<script type="text/javascript">
function count(){
var x=document.getElementById("txt1");
var y=document.getElementById("txt2");
switch(select){
case "+": sum=x+y;break;
case "-": sum=x-y;break;
case "*": sum=x*y;break;
case "/": sum=x/y;break;
default : sum="default"; break;
}
}
ducument.getElementById("fruit").value = sum;
</script>
</head>
<body>
<input type='text' id='txt1' />
<select id='select'>
<option value='+'>+</option>
<option value="-">-</option>
<option value="*">*</option>
<option value="/">/</option>
</select>
<input type='text' id='txt2' />
<input type='button' value=' = ' onClick="count()"/> <!--通过 = 按钮来调用创建的函数,得到结果-->
<input type='text' id='fruit' />
</body>
</html>
qq_位卑未敢忘忧国_0
qq_轉裑灬巳陌_0
Caballarii