Basics of JavaScript

If you already are not aware, with HTML you can only create static web pages. A static web page simply is a page whose content or layout won't change. A dynamic page, on the other hand, is interactive and whose content changes according to the scripting instructions specified. To create a dynamic web page, you simply write a small program using a web programming language like Active Serer Pages, JavaScript, Perl, PHP, etc.

Server-side and client-side Scripting

The programs or scripting instruction that run on the server are referred to as server-side scripting. Active Server Pages is an example of a server-side technology which runs on a Windows server. The main advantage of using a server-side language is that the scripting code remains and runs on the server. One of the main disadvantages of using a server-side technology is that server slows down as many users access resources from the server. To combat that problem and other server-side scripting problems, use of client-side scripting is preferred.

JavaScript is a popular client-side scripting language. Client-side scripts run on the client's (user's) computer thus are more responsive to user's actions than a server-side script as the data does not have to be sent over the internet.

JavaScript code is placed between the <script> and </script> tags. And, the JavaScript code inside the <script> tag can be placed directly in an HTML document. You may also link external JavaScript files to an HTML document. By doing that, you can share your JavaScript across multiple web pages.

Before you start writing JavaScript code, you should understand: