Home >
Article > Web Front-end > Analysis of the differences in the use of confirm, alert, and prompt functions in JS_javascript skills
Analysis of the differences in the use of confirm, alert, and prompt functions in JS_javascript skills
- WBOYOriginal
- 2016-05-16 18:30:591399browse
window.alert: There is only one parameter, which displays the information of the warning box;
No return value.
window.confirm: There is only one parameter. Display Information about the prompt box.
Press OK to return true; press Cancel to return false.
window.prompt: Parameters, there are two,
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. <script> <BR>window.alert("确定.") <BR></script>Returns the value entered by the user. <script> <BR>var bln = window.confirm("确定吗?"); <BR>alert(bln) <BR></script><script> <BR>var str = window.prompt("请输入密码","password") <BR>alert(str); <BR></script>
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn