Many websites simply display text and images. They're a one way process with no interaction between the web page and the web page user. However, that's not really natural for human beings – they are more used to two-way communications both at a conscious level (for example talking and listening) and a subconscious level (for example body language).
The question is, therefore, can a web page developer create a two-way dialogue with their users. The answer is – yes. With the introduction of just a few simple techniques a web page can obtain information from its users rather than just presenting it to them.
Simple Alerts and Confirmations
The simplest communication can be achieve by using the javascript alert function, for example within the onclick even of a button:
However, even that is rather one sided. The first glimmering of an actual conversation starts with the use of the confirm function. Now the script can obtain some information from the user:
This will just return a simple true or false condition. The next step is to obtain some text from the user.
Prompting with Javascript
It's possible to create a simple yes/no conversation going by using just the confirm function:
The prompt function enables the web page developer to obtain a written response from the user:
In this example an editable text box will be displayed. The first parameter will appear as a title and the second will populate the text box. It will return either the contents of the box (if "OK" is clicked) or null (if "Cancel" is clicked).
Each of these gives makes the site much more interactive for the user. Rather than taking a passive role they become part of the experience. And, in fact, this may help the user to remember the content of the web site more effectively. Current research shows that text written in easy to read fonts (such as Serif) is less well remember than text written less readable fonts and may impair cognition.
It may well be that by giving the user more to do on the web page the developer may actually create a more informative site, not by providing extra content, but by providing extra activities.