BMR AI
By using this service you agree to read and accept our Terms and conditions and Privacy Policy
Chat Now
GUIDE

Welcome to our BMR AI CHATBOT.

A free expermental AI tool where you can interact with the webpage, ask question about the webpage and other related doubts.

In some cases reponses may take time to get. In case of error give us your report.

You responses are stored for experimental purpuses. And your personal info is not integrated with you in any way.

Note: AI can make mistakes and can give in appropiate responses. Your feedbak will help us improve.

Stay tuned for more AI products and tools

And Finally don't forget to give your feedback. click on the icon provided to give feedback.

REPORT ERROR

SUBMIT
DELETE CHAT

HTML JavaScript (js)

In HTML, you can use JavaScript to interact with the DOM (Document Object Model) and manipulate the content and behavior of your web page dynamically.
Mainly Javascript is used to make pages interative.
Let's see some of the methods how javascript is used in HTML.


Inline Javascript

You can include JavaScript code directly within your HTML file using the <script> tag.
This method is suitable for small snippets of code.
Basically these script tag are kept in body and head tags.

Example

<!DOCTYPE html>
<html>
<head>
    <title>Inline JavaScript</title>
</head>
<body>
    <h1>Hello, world!</h1>

    <script>
        // Inline JavaScript code
        alert('This is an inline JavaScript alert!');
    </script>
</body>
</html>

External Javascript

For more extensive JavaScript code, it's better to put the code in an external JavaScript file and link it to your HTML using the <script> tag's src attribute.
These script tag are also kept in body and head tags.

Example

<!DOCTYPE html>
<html>
<head>
    <title>External JavaScript</title>
    <script src="script.js" defer></script>
</head>
<body>
    <h1>Hello, world!</h1>
</body>
</html>

Handling Events

You can also use JavaScript to handle events such as button clicks, form submissions, etc.

Example

<!DOCTYPE html>
<html>
<head>
    <title>Event Handling</title>
</head>
<body>
    <button id="clickButton">Click Me</button>

    <script>
        document.getElementById('clickButton').addEventListener('click', function() {
            alert('Button clicked!');
        });
    </script>
</body>
</html>

<noscript> tag

The <noscript> tag in HTML is used to provide alternative content or instructions that should be displayed or executed if a web browser doesn't support or has disabled JavaScript.
When a browser encounters the <noscript> tag, it will display the content inside the tag only if JavaScript is not available or enabled in the user's browser.

Example

<!DOCTYPE html>
<html>
<head>
    <title>JavaScript Support</title>
</head>
<body>
    <h1>Hello, world!</h1>

    <noscript>
        <p>Please enable JavaScript to enjoy the full functionality of this website.</p>
    </noscript>
</body>
</html>

Quick Recap - Topics Covered

HTML JavaScript
Inline JavaScript
External JavaScript
Handling Events
<noscript> Tag

Practice With Examples in Compilers

The Concepts and codes you leart practice in Compilers till you are confident of doing on your own. A Various methods of examples, concepts, codes availble in our websites. Don't know where to start Down some code examples are given for this page topic use the code and compile or Try on own Now

Example JS

Example 1 Example 2 Example 3 Example 4 Example 5

Quiz


FOLLOW FOR MORE UPDATES

Official Facebook Account Official Instagram Account Offcial X (formerly known as Twitter) Account Offficial Youtube Channel
BMR EDUCATION © 2024 All rights reserved