Alert command pops up a prompt box
To facilitate an intuitive understanding of JavaScript, this section provides a few simple examples for JavaScript to get started learning. The following code is an example of a pop-up prompt box:
Copy Code code as follows:
<script type= "Text/javascript" >
Alert ("I am the hint text!") ");
</script>
Save the previous section of code as a alert.html (or alert.htm) with a text editor such as WordPad or other more advanced editors, such as EditPlus. Double-click alert.html to run it (the actual use of IE and other browsers to open the file), you will see the following pop-up prompt box:
Tips
If you are using IE browser tip: To help protect security, Internet Explorer has restricted this web page from running script or ActiveX space that can access your computer. , select Allow blocked content to allow IE browser to run the above JavaScript code.
Instance Syntax interpretation
The following is a simple explanation of the JavaScript syntax for the example above:
The <script type= "Text/javascript" > represents the beginning of the JavaScript code and the end of the,</script> representative. JavaScript code should be placed between this beginning and the end.
Alert ("I am the hint text!") "); Is the JavaScript Code, alert () indicates a pop-up box (as shown above), the code in English; Indicates the end.
The prompt text for the pop-up box is caused by "or" and is placed in alert ().