INTRODUCTION TO JAVASCRIPT 1 - SS2 PRACTICAL

 

Why Study JavaScript?

JavaScript is one of the 3 languages all web developers must learn:

  1. HTML to define the content of web pages

  2. CSS to specify the layout of web pages

  3. JavaScript to program the behavior of web pages


What Can JavaScript Do?

JavaScript is the programming language of the web.

It can calculate, manipulate and validate data.

It can update and change both HTML and CSS.


JavaScript Can Change HTML Content

One of many JavaScript HTML methods is getElementById().

The example below "finds" an HTML element (with id="demo"), and changes the element content (innerHTML) to "Hello JavaScript":

For Example

1. <!DOCTYPE html>

<html>

<body>


<h2>What Can JavaScript Do?</h2>


<p id="demo">JavaScript can change HTML content.</p>


<button type="button" onclick='document.getElementById("demo").innerHTML = "Hello JavaScript!"'>Click Me!</button>


</body>

</html>

Comments

Popular posts from this blog

THE CENTRAL PROCESSING UNIT (CPU)- DEFINITION, COMPONENTS OF CPU- CONTROL UNIT (CU), ARITHMETIC AND LOGIC UNIT (ALU), REGISTERS AND FUNCTIONS (SS1)

MID TERM PROJECT - JSS3 COMPUTER STUDIES (RESEARCH)

SS3 1ST TERM SCHEME OF WORK (DIGITAL TECHNOLOGIES) FOR 2026/27 ACADEMIC SESSION