Our Learning Journey

Using JavaScript in HTML

JavaScript can be inserted into HTML documents by using the <script> tag

Scripts can be placed in the HEAD or in the BODY
– In the HEAD, scripts are run before the page is displayed
– In the BODY, scripts are run as the page is displayed


<html>
      <head>
      <title>Hello World in JavaScript</title>
      </head>
      <body>
            <script type="text/javascript">
             document.write("Hello World!");
            </script>
       </body>
</html>

Leave a Reply

Your email address will not be published. Required fields are marked *