An HTML document can contain blocks of code called scripts.
Depending on the browser and the server, the code can be written in a variety of languages.
Client-side scripts are executed by the browser.
Server-side scripts are executed by the server.
Client-side scripts are preferable to server-side scripts because they use the computer running the browser to execute. We don't like to waste valuable server CPU cycles to execute scripts. Alas, sometimes it is necessary to do this. For example, complex business logic involving accessing a special database wouldn't be practical or secure if done in a client-side script.
Java Server Pages (JSP), Active Server Pages (ASP), and Common Gateway Interface (CGI) are all examples of server-side scripting.
Applets could be seen as an example of client-side scripting.
By far, the most popular types of client-side scripts are JavaScripts.
Here's what a client-side script looks like in HTML:
<script language="JavaScript">
<!-- hide from old browsers
//
code goes here
//-->
</script>
JavaScript is similar to Java, but it is not the same as Java. There are important differences. For example, JavaScript doesn't have the concept of a class.
Here are some applications of client-side scripts:
Generating dynamic HTML (see date.html)
Making web pages more fun (see mouse.html)
Making those annoying pop-ups (see win.html)
Providing rich web-based user interfaces
Form validation (see calculator.html)
Building simple web applications (see craps.html)