My First JavaScript

Use JavaScript to Change Text

This example writes "Hello JavaScript!" into an HTML element with id="demo":

My First JavaScript

JavaScript can change the content of an HTML element:

This is a demonstration.

My First JavaScript

JavaScript can change the style of an HTML element.

A browser without support for JavaScript will show the text written inside the noscript element.

Using a Full URL File Path

Mountain

Using a Relative File Path

Mountain

Using a Relative File Path

Mountain Page Title

The content of the body element is displayed in the browser window.

The content of the title element is displayed in the browser tab, in favorites and in search engine results.

Page Title

This is a Heading

This is a paragraph.

Page Title

This is a Heading

This is a paragraph.

All meta information goes before the body.

Page Title

My Web Page

A Paragraph

Page Title

Since we have specified a base URL, the browser will look for the image "html5.gif" at "https://www.w3schools.com/images/html5.gif"

W3Schools

The link above opens in a new window. This is because the base target is set to "_blank".

Page Title

This is a heading

This is a paragraph.