JavaScript Tutorials
JavaScript often abbreviated as JS, is a high-level, interpreted programming language with object-oriented capabilities. JavaScript is a very powerful client-side scripting language.
It is lightweight and primarily used on the Web Pages to create a dynamic and interactive experience for the user.
The HTML script Tag
The script tag is used to define a client-side script (JavaScript).
JavaScript can change HTML content
<!DOCTYPE html> <html> <body> <h2>Use JavaScript to Change Text</h2> <p>This example writes "Hello JavaScript!" into an HTML element with id="demo":</p> <p id="demo"></p> <script> document.getElementById("demo").innerHTML = "Hello JavaScript!"; </script> </body> </html>
JavaScript can change HTML styles and attributes
<!DOCTYPE html> <html> <body> <h2>Use JavaScript to Change Text</h2> <p>This example writes "Hello JavaScript!" into an HTML element with id="demo":</p> <p id="demo"></p> <script> document.getElementById("demo").style.fontSize = "18px"; document.getElementById("demo").style.color = "black"; document.getElementById("demo").style.backgroundColor = "green"; document.getElementById("image").src = "picture.gif"; </script> </body> </html>
Online javascript tutorials
You can customize this code further as per your requirement.