标签:get put error back span fun input err title
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="UTF-8"> 5 <title>简单计算器</title> 6 <script> 7 function cal() { 8 //获取文本框 9 var input = document.getElementById("ss"); 10 //获取框内的值 11 var ss = input.value; 12 try { 13 //计算 14 input.value = eval(ss); 15 } catch(e) { 16 input.value = "Error"; 17 } 18 } 19 </script> 20 </head> 21 <body> 22 <input type="text" id="ss"/> 23 <input type="button" value="=" onclick="cal();"/> 24 </body> 25 </html>
标签:get put error back span fun input err title
原文地址:http://www.cnblogs.com/excellent-vb/p/7729328.html