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