Home > Article > Web Front-end > Analysis of the difference between confirm, alert, and prompt functions in JS_javascript skills
window.alert: There is only one parameter, which displays the warning box information;
No return value.
<script> <br>window.alert("OK.") <br></ script> <br>window.confirm: There is only one parameter. Display the information in the prompt box. <br>Press OK to return true; press Cancel to return false. <br><script> <br>var bln = window.confirm ("Are you sure?"); <br>alert(bln) <br></script>
window.prompt: There are two parameters,
The first parameter displays the information of the prompt input box .
The second parameter is used to display the default value of the input box.
Returns the value entered by the user.