Three types of dialogs commonly used in JavaScript
Differences and connections between alert (), confirm (), prompt ():
1, alert Box alert ()
alert is a warning box, there is only one button" OK "no return value, warning boxes are often used to ensure that users can get some Information. When the warning box appears, the user needs to click the OK button to continue the Operation.
<" Span style= "margin:0px; padding:0px; font-family:arial, Helvetica, Song body; font-size:18px "><" Span style= "margin:0px; padding:0px; font-family:arial, Helvetica, Song body; font-size:18px "><" Span style= "margin:0px; padding:0px; font-family:arial, Helvetica, Song body; font-size:18px "> Syntax :
<script type= "text\javascript";
Alert ("text").
</script>
2, confirmation Box confirm () Span style= "margin:0px; padding:0px; font-family:arial, Helvetica, Song body; font-size:18px ">
confirm is a confirmation box, two buttons, OK or cancel, return TRUE or False. The confirmation box is used to enable users to verify or accept certain Information. When the confirmation box appears, the user needs to click the OK or Cancel button to continue the Operation. If the user clicks confirm, then the return value is True. If the user clicks cancel, The return value is False.
<" Span style= "margin:0px; padding:0px; font-family:arial, Helvetica, Song body; font-size:18px "><" Span style= "margin:0px; padding:0px; font-family:arial, Helvetica, Song body; font-size:18px "><" Span style= "margin:0px; padding:0px; font-family:arial, Helvetica, Song body; font-size:18px "> Syntax :
<script type= "text\javascript";
Confirm ("text")
< Span style= "margin:0px; padding:0px; font-family:arial, Helvetica, Song body; font-size:18px "><" Span style= "margin:0px; padding:0px; font-family:arial, Helvetica, Song body; font-size:18px "></script>
3, Cue box prompt ()
prompt is a prompt box that returns the input message, or its default value prompt is often used to prompt the user to enter a value before entering the Page. When the prompt box appears, the user needs to enter a value and then click the Confirm or Cancel button to continue the Manipulation. If the user clicks confirm, then the return value is the value Entered. If the user clicks cancel, The return value is Null.
<" Span style= "margin:0px; padding:0px; font-family:arial, Helvetica, Song body; font-size:18px "> syntax:
<script type= "text\javascript";
Prompt ("text", "default Value")
</script>
Introduction to javascript, Three common dialog boxes