JavaScript FeaturesQuestion: What can JavaScript programs do? Answer: The following list presents only some groups of typical tasks in which JavaScript proves very useful:
1. Giving the user more control over the browser.
2. Detecting the user's browser and OS. The ability to detect the user's browser and OS allows your script to perform platform-dependent operations, if necessary. Example.
Here users of different browsers will get different greetings:
3. Performing simple computations on the client side.
4. Validating the user's input.
Note that JavaScript helps the browser perform input validation without wasting the user's time by the Web server access. If the user makes a mistake in the input, the user will get an error message immediately! On the other hand, if the input information is validated only on the server, then the user would have to wait for the server response.
5. Handling dates and time.
Example 2. This script says "Nice morning, isn't it?" or "Good afternoon!" or "Good evening!" or "Wow, you are not asleep yet!?" depending on the current time. It also tells you today's date.
6. Generating HTML on the fly.
Every time you click on the arrows, the browser generates and displays new HTML code in the left frame. Thanks to JavaScript, this operation is performed on the client machine, and therefore you don't have to wait while the information goes back and forth between your browser and the Web server. |
|
Copyright © 1999-2011, JavaScripter.net.