Eric_W

Fixed javascript

Apr 22nd, 2011
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 0.64 KB | None | 0 0
  1. <html>
  2. <head>
  3. <script type="text/javascript">
  4. <![CDATA[
  5. function alertbox() {
  6.     var name = prompt("Input your name please","")
  7.     if(name != null && name != "") {
  8.         alert("Thanks")
  9.     }
  10.     else if(name == null) {
  11.         var doCancel = confirm("You are about to cancel this.\n" +
  12.                                "Press ok to continue, or press cancel to go " +
  13.                                "back and input your name!")
  14.         if (!doCancel) {
  15.             alertbox()
  16.         }
  17.     }
  18.     else if(name == "") {
  19.         alert("Please put a name in the text field!")
  20.         alertbox()
  21.     }
  22. }
  23. ]]>
  24. </script>
  25. </head>
  26. <body>
  27.     <input type="button" onclick="alertbox()" value="Press Me!" />
  28. </body>
  29. </html>
Advertisement
Add Comment
Please, Sign In to add comment