HTML Tutorial
Menu
HTML Forms
Menu
HTML Graphics
Menu
HTML Media
Menu
HTML API
Menu
HTML Javascript
JavaScript are used to make HTML pages more dynamic and interactive.
Example:
Output:
The HTML <script> Tag
The HTML <script> tag define a client-side script (JavaScript).
The <script> element contains script statements, or it refers to an external script file through the src attribute.
Some uses of JavaScript are image manipulation, form validation, and dynamic changes in content.
To select an HTML element, JavaScript uses the document.getElementById() method.
This JavaScript example writes “Hello JavaScript!” into an HTML element with id=”demo”:
Example
This example writes "Hello JavaScript!" into an HTML element with id="demo":
Output:
This example writes "Hello JavaScript!" into an HTML element with id="demo":