Home  >  Article  >  Web Front-end  >  How many js dialog boxes are there? Introduction to JavaScript dialog boxes

How many js dialog boxes are there? Introduction to JavaScript dialog boxes

云罗郡主
云罗郡主Original
2018-11-05 13:41:512951browse

There are many browsers now, and we use a lot of them. So do you know how many js dialog boxes there are? Let's learn about JavaScript dialog boxes.

How many js dialog boxes are there? Introduction to JavaScript dialog boxes

1: Currently in js, there are three main dialog boxes:

(1) alert();

(2)confirm();

(3)prompt();

The above three types all belong to window objects. Many programmers write them as window.confirm(), but Because window is a global object, many people abbreviate it as confirm(), and the same is true for the other two dialog boxes.

2: Introduction to 3 types of JavaScript dialog boxes:

1.alert syntax: alert(message);

Description: This dialog box is mainly used It is used for the prompt function, but it cannot affect the js script. The message in the syntax is a parameter, which is the content information of the prompt box. But one thing is that alert() has no return value, can support text line breaks, and can put variables put in.

2.confirm() syntax: confirm(message);

In the above code, message is a required option, which allows the user to confirm, and confirm() has a return value , the user can cancel the button, the return value is false, if click OK, the return value is true.

3.prompt() syntax: prompt(message);

prompt() is a dialog box used to enter information and return the input string. prompt() has a prompt function, and Return a string.

The above is what are the js dialog boxes? Introduction to JavaScript dialog boxes. If you want to know more about JavaScript Tutorial, please pay attention to the PHP Chinese website.


The above is the detailed content of How many js dialog boxes are there? Introduction to JavaScript dialog boxes. For more information, please follow other related articles on the PHP Chinese website!

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