<!DOCTYPE html><html><head>? ? <meta charset="UTF-8">? ? <title>計算器</title><script>? ? function calc() {? ? ? ? var x = parseInt(document.getElementById('sum1').value);? ? ? ? var y = parseInt(document.getElementById('sum2').value);? ? ? ? var fuhao = parseInt(document.getElementById('sym').value);? ? ? ? var he;? ? ? ? switch(fuhao){? ? ? ? ? ? case '+': he=x+y; break;? ? ? ? ? ? case '-': he=x-y; break;? ? ? ? ? ? case '*': he=x*y; break;? ? ? ? ? ? case '/': he=x/y; break;? ? ? ? }? ? ? ? document.getElementById('sum').value=he;? ? }</script></head><body>? ? <input type="text" id="sum1">? ? <select name="" id="sym">? ? ? ? <option value="+">+</option>? ? ? ? <option value="-">-</option>? ? ? ? <option value="*">*</option>? ? ? ? <option value="/">/</option>? ? </select>? ? <input type="text" id="sum2">? ? <input type="button" value=" = " onclick="calc()">? ? <input type="text" id="sum"></body></html>
求解到底哪錯了?
qq_昵稱_iklLX9
2018-10-26 04:49:14