The web nowadays offers more than just static text. Modern web pages can often interact with the user. For these interactions small programs, which run on the client computer, are being put into an HTML document and so called CGI programs that run on the server. There are two types of small programs that run on a client's computer.
CGI programs are programs that run on the web server. They get their input from a web page on the client computer and their output is a web page or image that will be sent to the client. They can be used to give a user requested information, like in a search engine, where the user enters his keywords and the CGI program checks it's database and returns links to sites about this keyword. CGI programs can also be used to gather user information. For more information about CGI, you can read the information processing section.
There are also other ways to add interactivity to a website like ActiveX and Shockwave Flash. However, ActiveX has some security loopholes and Flash requires the user to download a plug in and has quite limited capabilities compared to Java, we hardly ever use them.