Javascript development technology Daquan Chapter 1 JAVAScript journey

Source: Internet
Author: User

2.1 select an appropriate editing tool
1. notepad 2. Ultra Edit32: There are keywords for key Liao coloring and automatic correction. 3. EditPlus: the browser is embedded in its own window, allowing you to view the web page effect at any time.
4.1st JavaScript Editor has html tags, attributes, javascript events, and functions in addition to color. In addition, you can also use external editing to edit webpages, or you can also use common browsers to build in windows.
1 stJavaScript Editor 3.8 Special Edition
5. Dreamweaver 6. Other tools, including the editor provided by frontpage and netscape.
2.2 Insert javascript into Html
2.2.1 insert javascipt in the html document
<Html> <pead> <title> insert JavaScript code into HTML code </title> <meta http-equiv = "content-type" content = "text/html; charset = gb2312 "> </pead> <body> the line is text in HTML. </Body> </ptml>
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]
2.2.2 sequence of parsing cipts

It is parsed and executed in writing order.
2.2.3 script element attributes

Attribute name Attribute description
Charset Character Set of the script
Defer Load first and parse
Language Script Language
Src External script file address
Type Script Type
2.2.4 set the script language name
Copy codeThe Code is as follows:
<Script language = "javascript">
Jsonnet. write ("text output using javascript <br>");
</Script>

You can set different scripting languages in html.
2.2.5 set the version of the script language
2.2.6 set the script language type
2.2.7 reference an external script file
Use the src attribute of the script element. The value is url.
Using External Scripts has the following advantages:
1. Simplified html code
2. Modular programming
3. Easy code Maintenance
4. Increased security
5. Accelerated browsing
6. reference the Server File.
2.2.8 Simultaneous loading and post-loading
Add the defer attribute to the tag of <script>. The result is loaded and parsed.
<Html> <pead> <title> insert JavaScript code into HTML code </title> <meta http-equiv = "content-type" content = "text/html; charset = gb2312 "> </pead> <body> the line is text in html. </Body> </ptml>
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]
2.3 javascript comments
// The commented statement
/**/
2.4 The client scripting language is not supported.
<! -- Yyyyyyyy -->
2.5 method of calling and executing javascript code
1. directly executed javascript code
2. directly call a function
3. Use javascript: statement call
4. Call by event
Copy codeThe Code is as follows:
<Html>
<Head>
<Title> call by event </title>
<Meta http-equiv = "content-type" content = "text/html; charset = gb2312">
</Head>
<Body>
<A href = "#" onclick = "javascript: alert ('Hello! ') "> This is a hyperlink </a> <br>
<A href = "#" onclick = "alert ('Hello! ') "> This is another hyperlink </a> <br>
<Input type = "button" value = "button" onclick = "javascript: alert ('Hello ')">
<Input type = "button" value = "another button" onclick = "alert ('Hello ')">
</Body>
</Html>

2.6 debug javascript
2.7 precautions
1. Case Sensitive
2. indicates the end of the statement: adding a; sign or line break
This unit is complete.

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.