<!DOCTYPE?html>
<html>
?<head>
??<title>?事件</title>??
??<script?type="text/javascript">
???function?count(){
????var?a1?=?document.getElementById("text1".value);
????var?a2?=?document.getElementById("text2".value);
????var?b1?=?document.getElementById("fuhao".vaule);
????var?result?=?"";
????switch(b1)
????{
????????case?"+";
????????????result?=?a1?+?a2;
????????????break;
????????case?"-";
????????????result?=?a1?-?a2;
????????????break;
????????case?"*";
????????????result?=?a1?*?a2;
????????????break;
????????case?"/";
????????????result?=?a1?/?a2;
????????????break;
????}
????document.getElementById("fruit".vaule)=result;
????</script>
????</head>
?<body>
????<input?type="text"?id="test1">
????<select?id='fuhao'>
????????<option?value="+">+</option>
????????<option?value="-">-</option>
????????<option?value="*">*</option>
????????<option?value="/">/</option>
????</select>
????<input?type="text"?id="text2">
????<input?type="button"?value="="?onclick="count()"/>
????<input?type="text"?id="fruit"?/>???
?</body>
</html>
2019-04-25
第7行:var
?a1?=?document.getElementById(
"text1")
.value;
???
第8行:
var
?a2?=?document.getElementById(
"text2")
.value;
??
第9行:
var
?b1?=?document.getElementById(
"fuhao")
.vaule;
?13、16、19、22行應(yīng)把分號(hào)改為冒號(hào)? 如:case '+':
第26行:
?
document.getElementById(
"fruit")
.vaule=result;
第39行:
<input?type=
"text"
?id=
"fruit"
?onclick="count()"/>??
2019-05-12
第7行:var
?a1?= parseInt(document.getElementById(
"text1")
.value);
???
第8行:
var
?a2?= parseInt(document.getElementById(
"text2")
.value);
??
第9行:
var
?b1?=?document.getElementById(
"fuhao")
.value;
?13、16、19、22行應(yīng)把分號(hào)改為冒號(hào)? 如:case '+':
第26行:
?
document.getElementById(
"fruit")
.value = result;
在第26行和第27行之間再增加一個(gè) }
第39行:
<input?type=
"text"
?id=
"fruit" onclick="count()
"?/>??
幾個(gè)地方都把value寫(xiě)錯(cuò)了
2019-05-12
第7行:var
?a1?= parseInt(document.getElementById(
"text1")
.value);
???
第8行:
var
?a2?= parseInt(document.getElementById(
"text2")
.value);
??
第9行:
var
?b1?=?document.getElementById(
"fuhao")
.vaule;
?13、16、19、22行應(yīng)把分號(hào)改為冒號(hào)? 如:case '+':
第26行:
?
document.getElementById(
"fruit")
.vaule=result;
在第26行和第27行之間再增加一個(gè) }
第39行:
<input?type=
"text"
?id=
"fruit" onclick="count()
"?/>??
2019-04-28
不能用 break? 否則下面的不執(zhí)行了
2019-04-21
要學(xué)會(huì)用chrome的控制臺(tái),里面會(huì)告訴你哪里錯(cuò)了
2019-04-20
第7行括號(hào)錯(cuò)了
2019-04-20
30行test1應(yīng)該為text1 改了之后還是無(wú)效