Introduction to JavaScript----

Source: Internet
Author: User

Introduction to JavaScript

1. What is JavaScript?

It is a scripting language and requires a host file whose host file is an HTML file.

2. What does it have to do with Java?

What's the direct link, Java is Sun (No, has been acquired by Oracle), JavaScript is Netscape (Netscape has not, was bought by AOL), JScript is Microsoft, 90% like JavaScript, Some features can only be used on IE.

3. His usage

----has three blocks in the HTML position.

(1)

(2) <body> inside

(3)

For insurance purposes, it is generally written after <script language= "JavaScript" > code must be placed here </script>//language can be replaced by type.

4. Three common dialog boxes

(1) alert ("") warning dialog, the function is to pop up a warning dialog box.

(The code above, because the script contains the content is placed in front of <body>, so before the refresh of the contents of

Note:<script></script> inside the content can be placed in

(2) Confirm ("") determines the dialog box, the function is to pop up a selection of the OK dialog box, after clicking OK, it returns ture, click Cancel to return False, available variables to receive.

<script type="text/javascript">confirm ("i OK to close?")  ")</script>

This code above, can be placed in the head, can be placed in the body, can also be placed behind the HTML.

(3) prompt ("Hint text to display"), which is a popup dialog box that allows you to enter content. Prompt ("text", "value")

<script type= "Text/javascript" >prompt ("Please enter a number", "Be sure to enter a number Oh") </script>

Note: The text in the prompt is the content of the dialog box prompt, and value is the content displayed in the text box.

Introduction to JavaScript----

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.