Home > Web Front-end > JS Tutorial > body text

JavaScript study notes (16) System dialog box (alert, confirm, prompt)_Basic knowledge

WBOY
Release: 2016-05-16 17:52:29
Original
1192 people have browsed it

1. Warning box alert()

Copy code The code is as follows:

alert("Welcome !");

2. Information box confirm(), with cancel and OK buttons
Copy code The code is as follows:

if (confirm("Do you agree?")) {
alert("Agree");
} else {
alert("No Agree");
}

3. Prompt box prompt(), used to prompt the user to enter some text
Copy code The code is as follows:

var result = prompt("What is your surname?"," ");
if (result !== null) {
alert(“Welcome,” result);
}
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