Tech and Media Labs
This site uses cookies to improve the user experience.




JavaScript Introduction

Jakob Jenkov
Last update: 2014-06-15

JavaScript makes it possible to make your HTML document dynamic, meaning you can change the HTML document while it is being displayed in the browser.

JavaScript is a programming language. You embed JavaScript code inside your HTML using the script element, like this;

<script>
    alert("This is a JavaScript code snippet");
</script>    

This little example shows a JavaScript alert box with the text This is a JavaScript code snippet.

The JavaScript code is executed when the browser encounters it in the browser. That may actually be before the full HTML document is loaded.

You can do a lot with JavaScript. For instance, you can:

  • Listen for events on form elements.
  • Listen for events on HTML elements in general (on mouse over, mouse out, click etc.)
  • Execute scripts at timed intervals.
  • Change the HTML document.
  • Change the CSS styles used by HTML elements.
  • ... and much, much more...

JavaScript is a big topic to cover, so this tutorial will not get into more detail about JavaScript. The internet is full of JavaScript tutorials, so a quick search on the web will reveal a lot of resources that can help you learn JavaScript.

Jakob Jenkov




Copyright  Jenkov Aps
Close TOC