Home > Web Front-end > JS Tutorial > 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

WBOY
Release: 2016-05-16 18:30:59
Original
1418 people have browsed it
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>
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template