<!DOCTYPE?html>
<html>
<head>
????<title>實現(xiàn)計算功能</title>
</head>
<body>
<script?type="text/javascript">
????
????function?count()
????{var?a=document.getElementById("t1").value;
????var?b=document.getElementById("t2").value;
????var?c="";
????var?s=document.getElementById("select").value;
????????switch(s)
????????{case?"+":
????????????c=parseInt(a)+parseInt(b);
????????????break;
????????case?"-":
????????????c=parseInt(a)-parseInt(b);
????????????break;
????????case?"*":
????????????c=parseInt(a)*parseInt(b);
????????????break;
????????default:
????????????c=parseInt(a)/parseInt(b);
????????}
????????document.getElementById("t3").value=c;
????}
</script>
????<form>
???????<input?id="t1"?type="text"?/>
???????<select?id="select">
???????????<option?value="+">+</option>
???????????<option?value="-">-</option>
???????????<option?value="*">*</option>
???????????<option?value="/">/</option>
???????</select>
???????<input?id="t2"?type="text"?/>
???????<input?type="button"value="="?onclick
????????????="count()"/>
???????<input?id="t3"?type="text"?/>?
????</form>
</body>
</html>
2015-12-15
default后面的冒號你打成中文的了
2015-12-15