<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> </head> <body> <script type="text/javascript"> function a(){ var b=confirm("是否确定")//按确认和取消输出不同的内容 if(b==true){ document.write("you pressed ok!") // f(); }else{ // document.write("you pressed cancel!") } } function b(){ // var c=prompt('请输入'); var c=prompt('请输入','ss'); alert(c); // alert(parseInt(c)); // alert(typeof(c)); // document.write(c); } function f(){ alert(1111); } </script> <input type="button" οnclick="a()" value="aaaa"/> <input type="button" οnclick="b()" value="bbbb"/> </body> </html>