DEV Community

s mathavi
s mathavi

Posted on • Edited on

6 1 1

JavaScript Repeated Question: Dynamic Functional Interactive

Javascript is a programming language that makes our website dynamic , interactive and functional.
what is Dynamic
The content on the page can change automatically without refreshing the page.
examples:
-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>

Enter fullscreen mode Exit fullscreen mode

what is interactive
js makes this happen by responding to our actions(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>

Enter fullscreen mode Exit fullscreen mode

what is functional
the website can do real tasks using js
example :
-calculator 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 interesting topics . stay tune! Guys

Top comments (0)

Java-ready auth and billing that just works

Java-ready auth and billing that just works

Stop building auth from scratch. Kinde handles authentication, user management, and billing so you can focus on what matters - shipping great products your users will love.

Get a free account

👋 Kindness is contagious

Take a moment to explore this thoughtful article, beloved by the supportive DEV Community. Coders of every background are invited to share and elevate our collective know-how.

A heartfelt "thank you" can brighten someone's day—leave your appreciation below!

On DEV, sharing knowledge smooths our journey and tightens our community bonds. Enjoyed this? A quick thank you to the author is hugely appreciated.

Okay