JavaScript Tutorials

How to include JavaScript in HTML

To include dynamic JavaScript code in an HTML page, code the HTML <script> tag in the <head> section.

<head>
   ... metadata content ...
   <title>... text content ...</title>
   ...
   <script type="text/javascript" src="..."></script>
   <script type="text/javascript">
      ... JavaScript code ...
   </script>
   ...
</head>

See the <script> tag reference for details on how to code the <script> tag.

Tutorials on JavaScript for Beginners
onload Function Chaining
JavaScript escape vs. encode
A comparison of the JavaScript functions escape, encodeURI and encodeURIComponent showing the difference between them.
Advanced JavaScript Tutorials
XMLHttpRequest
XMLHttpRequest is a JavaScript object type that can be used to retrieve a resource via a URL. Despite the Http in the name of the type, an XMLHttpRequest object can be used to retrieve resources via various protocols including the
  • http,
  • ftp, and
  • file protocols.