JavaScript Repeated Question: Dynamic Funtional Interactive



This content originally appeared on DEV Community and was authored by s mathavi

Javascript is a proramming language makes our website dynamic , interactive and functional.
** what is Dynamic**
The content on the page can change automatically without refreshing the page.
exaples:
-In cricket live on tv the score is automatically updated.
-The clock on tv,websites.

<!DOCTYPE html>
<html>
<head>
  <title>Dynamic Example</title>
</head>
<body>

  <h2>Live Clock </h2>
  <p id="clock">Loading time...</p>

  <script>
    function updateClock() {
      const now = new Date();
      document.getElementById("clock").innerText = now.toLocaleTimeString();
    }

    setInterval(updateClock, 1000);
  </script>

</body>
</html>

Image description

what is interactive
js makes this happen by responding to our acions(called events)
example:
-clicking buttons
-typing a form and gives some alert messages.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=
device-width, initial-scale=1.0">
    <title>Interactivejs</title>
</head>
<body style="margin: auto;width:40%; border:1px solid black;padding: 50px;">
  <div>
    <h2 style="text-align: center;">Interactive</h2>
    <p>js is a proramming language used to make our webpage Interactive</p>
    <p>js makes this happen by responding to our actions like clicking buttons typing a form gives alert messages </p>
    <button onclick="interactive()">Click me</button>
    </div>
    <script>
        function interactive(){
            alert("Hello everyone");
        }
    </script>

</body>
</html>

Image description

what is functional
the website can do real tasks using js
example :
-calculater that gives correct answer
– In form that checks email is valid before submitting.
– clock example from dynamic also for functional

we will meet tomorrow with intersting topics . stay tune! Guys


This content originally appeared on DEV Community and was authored by s mathavi