Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
110
rated 0 times [  116] [ 6]  / answers: 1 / hits: 64040  / 14 Years ago, mon, august 16, 2010, 12:00:00

What is the main motto of using Javascript mostly. How it will be useful for developing Applications. I know Html. How it will help me in learning Javascript. Any relations to both JS and html.


More From » html

 Answers
99

The main use of Javascript is that it allows you to make things happen in the user's browser without sending messages back and forth to the server. There are a variety of reasons why you might want to do this.



For example, sending a message to the server and getting a reply is a relatively long process: it is almost always a noticable time lag, and can take many seconds. Doing something directly in the browser can be much faster. So if, for example, you want to give the user an invalid data message of some sort, it can be much faster if it comes from Javascript.



In the same vein, with Javascript you can validate field-by-field rather than waiting until the user has completely filled out the screen and clicked a submit button. For example, suppose you present the user with a screen where he's supposed to enter transaction dates and monetary amounts. The user enters a whole screen full of these -- maybe 20 or 30 transactions -- and then clicks submit. If the user attempts to type dates in a format that you don't recognize, say typing day/month/year when you expected year-month-day, then with Javascript you could give him an error on the first unrecognizable date. With a round trip to the server, he'd have typed in a whole screen-full of invalid dates before you tell him he's doing it wrong.



Similarly, trying to do animation with round trips to the server would be unlikely to work, it would be way too slow. One way to do it would be with Javascript. (There are other ways, of course.)


[#95894] Friday, August 13, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
domeniccolti

Total Points: 276
Total Questions: 98
Total Answers: 93

Location: India
Member since Fri, May 13, 2022
2 Years ago
domeniccolti questions
Mon, Oct 18, 21, 00:00, 3 Years ago
Thu, Oct 14, 21, 00:00, 3 Years ago
Thu, Jul 15, 21, 00:00, 3 Years ago
Sat, Oct 24, 20, 00:00, 4 Years ago
Thu, Sep 3, 20, 00:00, 4 Years ago
;