等于號哪去了?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>事件</title><script type="text/javascript">function count(){ var txt1,txt2,select,result; txt1=parseInt(document.getElementById('txt1').value); txt2=parseInt(document.getElementById('txt2').value); select=document.getElementById('select').value; switch(select){ case '+': result=txt1+txt2; break; case '-': result=txt1-txt2; break; case '*': result=txt1*txt2; break; case '/': result=txt1/txt2; break; } result=document.getElementById('fruit').value; }</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' /> ? <iput type='button' value=' = ' onclick='count()'/> ? <input type='txt' id='fruit'/> ? ? ?</body></html>?
這段代碼有什么問題嗎?怎么在瀏覽器里面顯示出來沒有等于號“=”
2015-02-08
你的"="的那個input拼錯了啊。。
2015-02-09
謝謝,以后得多注意了!
2015-02-08
多謝指點,按你說的改過后計算機確實可以運行了!可是我還是不是很明白,為什么
result=document.getElementById('fruit').value和
document.getElementById('fruit').value=result的運行結(jié)果不一樣?
2015-02-08
這里確實錯了,可是改回來了,計算器還是無法運行,點擊等于號沒有結(jié)果輸出,還有錯,求指點!
2015-02-08
汗,慚愧,我總是犯些低級錯誤,多謝大蝦!
2015-02-08
有什么不一樣嗎?
2015-02-08