显示提示框

  1. <html>
  2. <head>
  3. <script type="text/javascript">
  4. function disp_prompt()
  5. {
  6. var name=prompt("请输入您的名字","Bill Gates")
  7. if (name!=null && name!="")
  8. {
  9. document.write("你好," + name + "!今天过得好吗?")
  10. }
  11. }
  12. </script>
  13. </head>
  14. <body>
  15.  
  16. <input type="button" onclick="disp_prompt()" value="显示一个提示框" />
  17.  
  18. </body>
  19. </html>