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

JavaScript basic tutorial alert pop-up prompt box example

PHP中文网
PHP中文网Original
2016-05-16 19:01:541373browse

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>

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:
4ec11beb6c39d0703d1751d203c17053 represents the beginning of JavaScript code, and 2cacc6d41bbb37262a98f745aa00fbf0 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().

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