Home > Web Front-end > JS Tutorial > JavaScript study notes (16) System dialog box (alert, confirm, prompt)_Basic knowledge

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-05-16 17:52:29
Original
1232 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
Latest Issues
alert is not implemented yet
From 1970-01-01 08:00:00
0
0
0
javascript - Add alert to bootstrap popup layer
From 1970-01-01 08:00:00
0
0
0
alert("Hello JavaScript");
From 1970-01-01 08:00:00
0
0
0
Using $t in alert() for Vue’s i18n translation
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template