仿照6-3下载资料写的,无法运算出结果?
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>流程控制语句</title>
<script type="text/javascript">
function con() {
var aa=parseInt(document.getElementById('text1').value);
var bb=parseInt(document.getElementById('text2').value);
var select=document.getElementById('select').value;
var cc='';
switch(select)
{
case'+':
cc=aa+bb;
break;
case'-':
cc=aa-bb;
break;
case'*':
cc=aa*bb;
break;
case'/':
cc=aa/bb;
break;}
}
document.getElementById('fruit').value=cc;
}
</script>
</head>
<body>
<input type='text' id='text1'/>
<select id='select'>
<option value='+'>+</option>
<option value='-'>-</option>
<option value='*'>*</option>
<option value='/'>/</option>
</select>
<input type='text' id='text2'/>
<input type='button' value='=' onclick="con()"/>
<input type='text' id='fruit'/>
</body>
</html>