What Is The HTML JavaScript
HTML JavaScript makes HTML pages more powerful and intelligent.
Example
My First JavaScript
Snap me to show Date and Time
The HTML <script> Tag
The HTML<script> tag is utilized to characterize a customer side content (JavaScript).
The <script> component either contains script proclamations, or it focuses to an outside script record through the src property.
Normal uses for JavaScript are picture control, structure approval, and dynamic changes of content.
To choose a HTML component, JavaScript regularly utilizes the document.getElementById() strategy.
This JavaScript model expresses “Hi JavaScript!” into a HTML component with id=”demo”:
Example
<script>
document.getElementById(“demo”).innerHTML = “Hello JavaScript!”;
</script>
Tip: You can learn significantly more about JavaScript in our JavaScript Tutorial.
A Taste of JavaScript
Here are a few instances of what JavaScript can do:
Example
JavaScript can change content:document.getElementById(“demo”).innerHTML = “Hello JavaScript!”;
Example
JavaScript can change styles:document.getElementById(“demo”).style.fontSize = “25px”;
document.getElementById(“demo”).style.color = “red”;
document.getElementById(“demo”).style.backgroundColor = “yellow”;
Example
JavaScript can change ascribes :document.getElementById(“image”).src = “picture.gif”;
The HTML <noscript> Tag
The HTML <noscript>
tag characterizes a substitute substance to be shown to clients that have crippled contents in their program or have a program that doesn’t uphold scripts:
Example
<script>
document.getElementById(“demo”).innerHTML = “Hello JavaScript!”;
</script>
<noscript>Sorry, your browser does not support JavaScript!</noscript>
HTML Script Tags
Tag | Description |
---|---|
<script> | Defines a client-side script |
<noscript> | Defines an alternate content for users that do not support client-side scripts |