<html> <head> <title>js输入对话框</title> </head> <body> <script language="javascript"> <!-- age = prompt("请输入你的年龄:", "20"); if (age != null) { alert("你今年" + age + "岁了!"); } else { alert("你按了[取消]按钮"); } //--> </script> </body> </html>