等于號(hào)哪去了?
<!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>?
這段代碼有什么問題嗎?怎么在瀏覽器里面顯示出來沒有等于號(hào)“=”
2015-02-08
你的"="的那個(gè)input拼錯(cuò)了啊。。
2015-02-09
謝謝,以后得多注意了!
2015-02-08
多謝指點(diǎn),按你說的改過后計(jì)算機(jī)確實(shí)可以運(yùn)行了!可是我還是不是很明白,為什么
result=document.getElementById('fruit').value和
document.getElementById('fruit').value=result的運(yùn)行結(jié)果不一樣?
2015-02-08
這里確實(shí)錯(cuò)了,可是改回來了,計(jì)算器還是無法運(yùn)行,點(diǎn)擊等于號(hào)沒有結(jié)果輸出,還有錯(cuò),求指點(diǎn)!
2015-02-08
汗,慚愧,我總是犯些低級(jí)錯(cuò)誤,多謝大蝦!
2015-02-08
有什么不一樣嗎?
2015-02-08