Why Study JavaScript?
JavaScript is one of the 3 languages all web developers must learn:1. HTML to define the content of website pages
2. CSS to specify the layout of website pages
3. JavaScript
JavaScript Can Change HTML Content:
One of many JavaScript HTML methods isgetElementById().This example uses the method to "find" an HTML element (with id="demo") and changes the element content (
innerHTML) to "Hello
JavaScript":Example:
document.getElementById("demo").innerHTML = "Hello JavaScript";
JavaScript Can Change HTML Attribute Values:
In this example JavaScript changes the value of the src (source) attribute of an <img> tag:
The Light Bulb
JavaScript Can Change HTML Attribute Values
In this example JavaScript changes the value of thesrc (source) attribute of an <img> tag:![]() | |||
| TURN ON |
JavaScript Can Change HTML Styles (CSS)
Changing the style of an HTML element, is a variant of changing an HTML attribute:Example:
document.getElementById("demo").style.fontSize = "35px";
Javascript cource class#2



