Home > Web Front-end > JS Tutorial > JavaScript basic tutorial: alert pop-up box example_javascript skills

JavaScript basic tutorial: alert pop-up box example_javascript skills

WBOY
Release: 2016-05-16 16:33:50
Original
1558 people have browsed it

alert command pops up a prompt box

To facilitate an intuitive understanding of JavaScript, this section will provide several simple examples for introductory learning of JavaScript. The following code is an example of a pop-up prompt box:

Copy code The code is as follows:


Save the above part of the code as alert.html (or alert.htm) using a text editor (such as WordPad or other more advanced editors, such as EditPlus, etc.). Double-click alert.html to run it (actually use a browser such as IE to open this file), and you will see the following pop-up prompt box:

Tips

If you use IE browser prompt: In order to help protect security, Internet Explorer has restricted this web page from running scripts or ActiveX spaces that can access the computer. ”, then please select “Allow blocked content” to allow IE browser to run the above JavaScript code.

Explanation of syntax with examples

The following is a simple explanation of the JavaScript syntax of the above example:
represents the end. JavaScript code should be placed between this start and end.
alert("I am the prompt text!"); is JavaScript code. alert() means popping up a prompt box (as shown in the picture above), and the code ends with the English ";" symbol.
The prompt text of the pop-up box is enclosed in "" or '' and placed in alert().

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