Open links in new tab
  1. JavaScript

    High-level programming language
  2. Designed by

    Brendan Eich of Netscape first; then others contributed to ECMAScript standard

    First appeared

    4 December 1995
    Add JavaScript to your web page - HTML | MDN - MDN Web Docs

    Take your webpages to the next level by harnessing JavaScript. Learn in this article how to trigger JavaScript right from your HTML documents.

    Mozilla Developer
    HTML JavaScript - GeeksforGeeks

    JavaScript is added to an HTML document using the <script> tag to enable interactivity and dynamic behavior. JavaScript can be written directly inside the HTML file. An external .js file can be linked using the <sc…

    GeeksForGeeks
  1. JavaScript is a powerful programming language used to make web pages interactive and dynamic. It can be integrated into HTML in two main ways: inline within the HTML document or as an external file.

    Inline JavaScript

    To add JavaScript code directly within an HTML document, you use the <script> tag. This tag can be placed in either the <head> or <body> section of your HTML document, depending on when you want the JavaScript to execute.

    Example in the <head> Section

    If you want the JavaScript to run before the rest of the page loads, place the <script> tag in the <head> section:

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Today's Date</title>
    <script>
    let d = new Date();
    alert("Today's date is " + d);
    </script>
    </head>
    <body>
    </body>
    </html>
    Copied!

    Example in the <body> Section

    If you want the JavaScript to run at a specific point within the page layout, place the <script> tag in the <body> section:

    Feedback
  2. Add JavaScript to your web page - HTML | MDN - MDN Web Docs

    Sep 11, 2025 · Take your webpages to the next level by harnessing JavaScript. Learn in this article how to trigger JavaScript right from your HTML documents.

  3. HTML JavaScript - GeeksforGeeks

    Jan 17, 2026 · JavaScript is added to an HTML document using the <script> tag to enable interactivity and dynamic behavior. JavaScript can be written directly inside the HTML file. An external .js file can …

    • Codecademy
      https://www.codecademy.com › get-started › free
      About our ads

      Master Javascript | Beginner Javascript | Learn by Doing

      SponsoredTake your skills to a new level and join millions of users that have learned Javascript. Learn key takeaway skills of Javascript and earn a certificate of completion.
    • Coursera
      https://www.coursera.org
      About our ads

      HTML Development Course - HTML, CSS, & JavaScript

      SponsoredLearn the essentials with the IBM Full Stack Software Developer Professional Certificate. Prepare for new roles with the IBM Full Stack Software Developer Professional Certificate.
    • JetBrains
      https://www.jetbrains.com › javascript_ide › webstorm
      About our ads

      Best JavaScript IDE | WebStorm, a JetBrains IDE

      SponsoredEnjoy more productive JavaScript development with WebStorm. Ready to use out of the box. No plugin configuration required. Try it now for free!