求助 求助
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<script>
function abc()
{
var tXt1=parseInt(document.getElementById('txt1').value);
var sel=documet.getElementById('select1').value;
var tXt2=parseInt(document.getElementById('txt2').value);
var result='';
switch(sel)
{
case '+':
result=tXt1+tXt2;
break;
case '-':
result=tXt1-tXt2;
break;
case '*':
result=tXt1*tXt2;
break;
case '/':
result=tXt1/tXt2;
break;
}
document.getElementById('txt3').value=result;
}
</script>
</head>
<body>
<input type="text" id="txt1">
<select id="select1" >
<option value="+">+</option>
<option value="-">-</option>
<option value="*">*</option>
<option value="/">/</option>
</select>
<input type="text" id="txt2" />
<input type="button" id="btn" value="=" onclick="abc()"/>
<input type="text" id="txt3" />
</body>
</html>