as inline : <input type=button value="warning" onclick="alert('Your days are numbered')"> as script: | <script> <---- function warnUser{ alert("Up to this point is okay!"); } //----> </script> |
users who close the box without typing in the input will cause the prompt to return "null" as the result.
This is annoying and will cause errors if an input is required. Solution: assign a valid variable to replace the null value.
userSay=prompt("What's your name?",""); if (userName==""|userName=="null"){userName="No Name"}; |
confirm("condition"); |