[JavaScript tutorial] JavaScript Introduction

Source: Internet
Author: User
JavaScript is the most popular scripting language on the Internet. It can be used for HTML and web, and is widely used in servers, PCs, laptops, tablets, smartphones, and other devices. JavaScript is a scripting language

JavaScript Introduction

JavaScript is the most popular scripting language on the Internet. It can be used for HTML and web, and is widely used in servers, PCs, laptops, tablets, smartphones, and other devices.

JavaScript is a scripting language

JavaScript is a lightweight programming language.

JavaScript is the programming code that can insert HTML pages.

After JavaScript is inserted into the HTML page, it can be executed by all modern browsers.

JavaScript is easy to learn.

What will you learn

The following is the main content you will learn in this tutorial.

JavaScript: Writing HTML output streams directly

Instance

Document. write ("this is a title"); document. write ("

This is a paragraph.

");

You can only use document. write in HTML output. If you use this method after the document is loaded, the entire document will be overwritten.

JavaScript: Event Response

Instance

Click me!

Alert () functions are not commonly used in JavaScript, but they are very convenient for code testing.


Onclick events are only one of the many events you will learn in this tutorial.

JavaScript: modifying HTML content

Using JavaScript to process HTML content is very powerful.

Instance

X = document. getElementById ("demo") // search for the element x. innerHTML = "Hello JavaScript"; // change the content

You will often see document. getElementById ("some id "). This method is defined in html dom.

DOM (Document Object Model) is a formal W3C standard used to access HTML elements.

You will learn about html dom in multiple chapters of this tutorial.

JavaScript: modifying HTML Images

This meeting dynamically changes the HTMLSource (src ):

Light bulb

JavaScript can change most attributes of any HTML element, not just images.

JavaScript: Change the HTML Style

Modifying the style of HTML elements is a variant of modifying HTML attributes.

Instance

X = document. getElementById ("demo") // find the x. style. color = "# ff0000"; // change the style.

JavaScript: Verify Input

JavaScript is often used to verify user input.

Instance

If isNaN (x) {alert ("not a number ")};

Do you know?

JavaScript and Java are two completely different languages, both in terms of concept and design.
Java (invented by Sun) is a more complex programming language.

The ECMA-262 is the official name of the JavaScript standard.

JavaScript was invented by Brendan Eich. It appeared in Netscape in 1995 (the browser has stopped updating) and was adopted by ECMA in 1997.

The above is the introduction to JavaScript in the [JavaScript tutorial]. For more information, see the PHP Chinese website (www.php1.cn )!

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.