Home > Web Front-end > JS Tutorial > JavaScript basic tutorial alert pop-up prompt box example

JavaScript basic tutorial alert pop-up prompt box example

PHP中文网
Release: 2016-05-16 19:01:54
Original
1433 people have browsed it

This article mainly introduces the example of the alert pop-up prompt box in the basic JavaScript tutorial. The focus of this article is to explain the basic syntax and basic usage of JavaScript. Friends in need can refer to the

alert command pop-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:

<script type="text/javascript">
alert("我是提示文字!");
</script>
Copy after login

Save the above part of the code as alert.html using a text editor (such as WordPad or other more advanced editors, such as EditPlus, etc.) (or alert.htm). 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:

Prompt

Tips if you use IE browser: In order to protect security, Internet Explorer has restricted this webpage 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 example syntax

The following is the above example A simple explanation of JavaScript syntax:
represents the end of JavaScript code. 🎜>alert("I am the prompt text!"); is the JavaScript code. alert() means popping up a prompt box (as shown in the picture above). The code ends with the English ";" which means the prompt text of the pop-up box. "" or '' and put it 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