Curriculum
Course: HTML Basic
Login

Curriculum

HTML Basic

HTML Introduction

0/1

HTML Editors

0/1

HTML Elements

0/1

HTML Attributes

0/1

HTML Headings

0/1

HTML Paragraphs

0/1

HTML Styles

0/1

HTML Formatting

0/1

HTML Quotation

0/1

HTML Comments

0/1

HTML Colors

0/1

HTML Favicon

0/1

HTML Page Title

0/1

HTML Block and Inline

0/1

HTML Iframes

0/1

HTML Java Script

0/1

HTML File Paths

0/1

HTML - The Head Element

0/1

HTML Style Guide

0/1

HTML Entities

0/1

HTML Symbols

0/1
Text lesson

HTML JavaScript

JavaScript enhances HTML pages by making them more dynamic and interactive.

 

The HTML <script> Tag

 

The HTML <script> tag serves to specify a client-side script (JavaScript).

Within the <script> element, script statements are included, or it can reference an external script file via the src attribute.

JavaScript finds common applications in tasks like image manipulation, form validation, and dynamically altering content.

For selecting HTML elements, JavaScript frequently employs the document.getElementById() method.

Below is an example of JavaScript code that writes “Hello JavaScript!” into an HTML element identified by the id=”demo”:

Example

<script>
document.getElementById(“demo”).innerHTML = “Hello JavaScript!”;
</script>

A Taste of JavaScript

Below are some instances showcasing the capabilities of JavaScript:

Example

JavaScript has the ability to alter content.

document.getElementById(“demo”).innerHTML = “Hello JavaScript!”;

Example

JavaScript can modify styles.

document.getElementById(“demo”).style.fontSize = “25px”;
document.getElementById(“demo”).style.color = “red”;
document.getElementById(“demo”).style.backgroundColor = “yellow”;

Example

JavaScript has the capability to modify attributes.

document.getElementById(“image”).src = “picture.gif”;

The HTML <noscript> Tag

The HTML <noscript> tag specifies alternative content to be shown to users who have disabled scripts in their browser or are using a browser that doesn’t support scripts.

Example

<script>
document.getElementById(“demo”).innerHTML = “Hello JavaScript!”;
</script>
<noscript>Sorry, your browser does not support JavaScript!</noscript>

 

Click to Learn