JavaScript base teach alert pop-up prompt box instance _javascript tips

Source: Internet
Author: User

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 ().

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.