link in javascript code example

Example 1: link javascript to html

<script src="index.js"> </script>

Example 2: link javascript html

<script type="text/javascript" src="monscript.js"></script>

Example 3: javascript link in html

<script type="text/javascript" src="./der/pfad/zu/der/datei.js"></script>

Example 4: create a link javascript

<html>
  <head></head>
  <body>
    <script>
      var a = document.createElement('a');
      var linkText = document.createTextNode("my title text");
      a.appendChild(linkText);
      a.title = "my title text";
      a.href = "http://example.com";
      document.body.appendChild(a);
    </script>
  </body>
</html>