JavaScript Summary: JavaScript learning Summary

Source: Internet
Author: User

JavaScript was invented by Netscape; syntax is very similar to Java; but note that Java and JavaScript have nothing to do with it.
There are many built-in objects in JavaScript that do not require user creation;
Tips for using HTML:
(1) If you want to output an empty table, you need <td> </td>
(2) in EditPlus to support the rapid browsing of the production of Web pages, shortcut keys are ctrl+b;
First, use JavaScript
If you want to introduce JavaScript into HTML, there are two ways:
(1) Internal introduction: JS code directly in the HTML writing;
The structure of the import is as follows:
<script language= "JavaScript" >
....
</script>
The general JS code is placed in the head tag;
(2) External introduction: JS code in the external writing after the import into the HTML;
<script language= "JavaScript" src= "1.js" >
....
</script>
Second, JavaScript grammar
1. Jump out of alert box
In JavaScript, the most used is alert, which causes the browser to pop up a prompt box;
Alert ("Hello world!!!"); You can pop a Hello world!!! the Prompt box;
<title></title>
<script language= "JavaScript" >
Alert ("Welcome!") ");
Alert ("Thank you!") ");
</script>
2. Page output content document.write ()
This statement is also very common and can output content directly to the page, such as:
document.write ("This statement is very similar to the OUT.PRINTLN () in the JSP;
<title></title>
<script language= "JavaScript" >
document.write ("</script>
3. Define variable var
This feature is very similar to Python, Java, there are a number of specific data types, but in JS, only need to give any type of value to Var;
For example:
(1) var num1 = 5; The type of NUM1 is an integer;
(2) var str1 = "Hello world!!!"; The type of str1 is a string;

Related Article

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.