Latest web development tutorials

JavaScript Tutorial

JavaScript Tutorial JavaScript Introduction JavaScript usage JavaScript Output JavaScript grammar JavaScript Statement JavaScript Notes JavaScript variable JavaScript type of data JavaScript Object JavaScript function JavaScript Scope JavaScript event JavaScript The string JavaScript Operator JavaScript Comparison JavaScript If...Else JavaScript switch JavaScript for JavaScript while JavaScript Break & Continue JavaScript typeof JavaScript Type conversion JavaScript Regular Expressions JavaScript error JavaScript debugging JavaScript Variable promotion JavaScript Strict mode JavaScript Use errors JavaScript Form validation JavaScript Keep the keyword JavaScript JSON JavaScript void JavaScript Code specification

JS function

JavaScript Function definition JavaScript Function parameter JavaScript Function call JavaScript Closure


DOM Introduction DOM HTML DOM CSS DOM event DOM EventListener DOM element

JS Advanced Tutorial

JavaScript Object JavaScript Number JavaScript String JavaScript Date JavaScript Array JavaScript Boolean JavaScript Math JavaScript RegExp Object

JS Browser BOM

JavaScript Window JavaScript Window Screen JavaScript Window Location JavaScript Window History JavaScript Navigator JavaScript Pop-ups JavaScript Timing events JavaScript Cookies

JS Library

JavaScript Library JavaScript test jQuery JavaScript test Prototype

JS Examples

JavaScript Examples JavaScript Object instance JavaScript Browser object instance JavaScript HTML DOM Examples JavaScript to sum up

JS Reference Manual

JavaScript Object HTML DOM Object

Introduction to JavaScript

JavaScript is the Internet's most popular scripting language, this language can be used for HTML and web, but also widely used for server, PC, laptop, tablet PCs and smart mobile phones and other devices.

JavaScript is a scripting language

JavaScript is a lightweight programming language.

JavaScript is a programming code can be inserted into the HTML page.

After the JavaScript into HTML pages, by all modern browsers execution.

JavaScript is easy to learn.

What you will learn

The following are the main contents of this tutorial, you will learn of.

JavaScript: Direct write HTML output stream


document write ( "<h1> This is a heading </ h1>");. . document write ( "<p> This is a paragraph </ p>.");

try it"

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

JavaScript: The reaction to events


< button type = " button " onclick = " alert('欢迎!') " >点我!</ button >

try it"

alert () function in JavaScript is not commonly used, but it is very convenient for code testing.

onclick event is just one of the many upcoming events that you learned in the tutorial.

JavaScript: changing the HTML content

To handle HTML content using JavaScript is very powerful.


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

try it"

You will often see document.getElementById ( "some id"). This method is defined in the HTML DOM.

DOM (D ocument O bject M odel ) ( Document Object Model) is the official W3C standard for accessing HTML elements.

In this tutorial you will learn about several chapters HTML DOM knowledge.

JavaScript: changing the HTML image

The regular meeting to dynamically change the HTML <image> source (src):

Lit bulb


try it"

JavaScript can change most of the properties of any HTML element, not just pictures.

JavaScript: changing HTML styles

Change the style of an HTML element belonging to change variant HTML attributes.


x = document . getElementById ( " demo " ) // 找到元素 x . style . color = " #ff0000 " ; // 改变样式

try it"

JavaScript: input validation

JavaScript is often used to validate user input.


if isNaN ( x ) { alert ( " 不是数字 " ) } ;

try it"

Did you know?

lamp JavaScript and Java are two completely different languages, either in concept or design.
Java (invented by Sun) is more complex programming languages.

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

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