HTML Javascript

What Javascript do in HTML?

JavaScript is an advanced programming language that makes web pages more interactive and dynamic.

JavaScript makes HTML pages more dynamic and interactive.


What can JavaScript Do in HTML

JavaScript Can Show HTML Elements.

JavaScript Can Hide HTML Elements.

JavaScript Can Change HTML Styles.

JavaScript Can Change HTML Attribute Values.

JavaScript Can Change HTML Content.


The HTML <script> Tag

The HTML <script> tag is used to define a JavaScript.

To select an HTML element, JavaScript most often uses the document.getElementById() method.


HTML Javascript example:

                                                    
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Modified JavaScript Example</title>
  <style>
    #Paragraphs {
      color: #3498db;
      font-size: 18px;
      font-family: 'Arial', sans-serif;
    }
  </style>
</head>
<body>
  <p id="Paragraphs"></p>
  <script>
    document.getElementById("Paragraphs").innerHTML = "Hello!, World! Welcome to the world of coding in Learn fasta.";
  </script>
</body>
</html>
                                                    
                                                

<noscript>

noscript : tag is a block element designating a section of HTML to be inserted if browser scripting is turned off.

The noscript tag can also designate a section of HTML for insertion because of an unsupported script type.

defines a section of HTML to be inserted if a script type on the page is unsupported or if scripting is currently turned off in the browser.


                                                    
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>JavaScript Support Check</title>
  <style>
    body {
      font-family: 'Arial', sans-serif;
      text-align: center;
      margin-top: 50px;
      font-size: 18px;
    }
    .noscript-message {
      color: #e74c3c; /* Red color for error message */
    }
  </style>
</head>
<body>
  <script>
    document.write("Your browser supports JavaScript.")
  </script>
  <noscript class="noscript-message">
    Sorry, your browser does not support JavaScript.
  </noscript>
</body>
</html>