Javascript

       Javascript was constructed to make small programs in XHTML documents. This also means it's a client side language - it runs on the client (the users PC), not on the webserver. Here's a small example:

<script language=JavaScript>
  <!-- // Hides the script from older browsers

  document.write("Hello world!")
  
  // End of comment hiding the script from older browsers -->
</script>
       The script tag can appear in both head and body, depending on where it's being used. E.g. functions typically are in the head. The example above don't do much - instead of the sentence "Hello world!" just being in the XHTML document, it's being written from javascript. The next example is more exciting.
<script language=JavaScript>
  <!-- // Hides the script from older browsers
  document.write("<table border='1'>")
  for (i=1; i<11; i++) {
    document.write("<tr>")
    for (j=1; j<11; j++) {
      document.write("<td align='right'>" + i*j + "</td>")
    }
    document.write("</tr>")
  }
  document.write("</table>")
  // End of comment hiding the script from older browsers -->
</script>
       Rather than explaining the example above, I'll just say, that this little piece of program can make the small table (all products between 2 numbers between 1 and 10), including the arithmetic, in amazingly few lines.

Concept last updated: 25/08 2003.

Relations

can be part of
is a kind of
is one of

Other sources

Insert, update, delete Javascript Klasse-hændelses-tabel

Libellus