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----