codescracker


html

HTML JavaScript



« Previous Tutorial Next Tutorial »


JavaScript helps in making HTML pages more interactive and dynamic.

HTML <script> Tag

The HTML <script> tag is used to define a client-side script, such as a JavaScript.

Let's look at the following example where the script writes Hello JavaScript into an HTML element with id="demo1"

<!DOCTYPE html>
<html>
<body>

<p id="demo1"></p>
<script>
	document.getElementById("demo1").innerHTML = "Hello JavaScript";
</script> 

</body>
</html>

Here is the live demo output produced by the above HTML JavaScript example code:

HTML <noscript> Tag

The <noscript> tag is used to provide an alternate content for users that have disabled scripts in their browser or have a browser that doesn't support client-side scripting.

Let's look at the following example, shows how to use noscript tag.

<!DOCTYPE html>
<html>
<body>

<p id="demo2"></p>
<script>
	document.getElementById("demo2").innerHTML = "Hello JavaScript";
</script> 
<noscript>
	Sorry, your browser does not support JavaScript OR you have disabled JavaScript
</noscript>

</body>
</html>

Here is the live demo output of the above noscript tag example code:

Here, if your browser supports scripting (JavaScript), it will display Hello JavaScript, otherwise it will display Sorry, your browser does not support JavaScript OR you have disabled JavaScript.

If you want to learn more about JavaScript, visit JavaScript Tutorial.


« Previous Tutorial Next Tutorial »



Tools
Calculator

Quick Links
Signup - Login - Give Online Test