Course Content
HTML Introduction
0/1
HTML Editors
0/1
HTML Basic Tags
0/1
HTML Elements
0/1
HTML Attributes
0/1
HTML Headings
0/1
HTML Paragraph
0/1
HTML Text Formatting
0/1
HTML Meta Tags
0/1
HTML Quotations
0/1
HTML Comments
0/1
HTML Images
0/1
HTML Background
0/1
HTML Colors
0/1
HTML Lists
0/1
HTML Tables
0/1
HTML Forms
0/1
HTML Spell Check
0/1
HTML Media
0/1
HTML Marquees
0/1
HTML CSS
0/1
HTML Links
0/1
HTML Block & Inline
0/1
HTML Classes
0/1
HTML Id
0/1
HTML I frames
0/1
HTML Java script
0/1
HTML File paths
0/1
HTML Layout
0/1
HTML Responsive
0/1
HTML Computer Code
0/1
HTML Tutorial
About Lesson

HTML Javascript

In this tutorial, we will learn about Javascript and its implementation in HTML with the help of examples.


Javascript

A script is a small piece of program that can add interactivity to your website. The script could be written using JavaScriptVBScript or Typescript.
These days only JavaScript and its frameworks are being used by most of the web developers.
VBScript is not even supported by various major browsers.


<script> Element

JavaScript makes HTML pages more dynamic and interactive.
The <script> tag is used to define a client-side script (javascript).
The <script> element is used to script statements internally (inside the HTML document), or it points to an external script file through the src attribute.
Common uses for Javascript are manipulation, form validation, image, and dynamic changes of content.

Example :

<!DOCTYPE html>
<html>
  <head>
    <title>Script element</title>
  </head>
  <body>
    <input type = "button" onclick = "Hello()" name = "yes" value =
"click me" />
    <script>
      function Hello() {
        alert("Hello, World!");
      }
    </script>
  </body>
</html>

Output



<noscript> Element

The <noscript> element defines an alternate content to be displayed to users.
This element disables script in the user’s browser or has a browser that does not support scripts.

Example :

<!DOCTYPE html>
<html>
  <head>
    <title>Noscript element</title>
  </head>
  <body>
    <p id = "myElement"></p>
    <script>
      document.getElementById("myElement").innerHTML = "Hello
Javascript"
;
    </script>
    <noscript>Sorry, your browser does not support
Javascript.</noscript>
    <p>A Browser without the support of Javascript will show the
text written inside the noscript element.</p>
  </body>
</html>

Output

Hello Javascript

A Browser without the support of Javascript will show the text written inside the noscript element.

error: Content is protected !!