<html> <head> <title>我的计算器</title> <script language="javascript"> function check(){ //js的内容 var num1var=document.getElenmentById("num1").value; var num2var-document.getElenmentById("num2").value; if(isNaN(num1val) || isNaN(num2val)){ window.alert("num1和num2必须是数"); //如果返回false就不提交. return false; }} </script> <head> <h1>我的计算器</h1> <form action="CalProcess.php" method="post"> num1:<input type="text" name="num1"></br> num2:<input type="text" name="num2"></br> oper: <select name="oper"> <option value="+">+</option> <option value="-">-</option> <option value="*" >*</option> <option value="/">/</option> <input type="submit" value="提交"> </form> </html>