Login | Message Boards | Newsletters | Help and FAQs | Contact Us
Professor's House Logo

image of computer code on a monitorJavaScript is an object-oriented scripting language that lets you build interactions between web page content, the state of the browser, and the actions of the reader. It is an easy-to-use programming language that can be embedded into web pages. It lets your pages interact with your readers, and respond to what they do. It enhances the overall dynamics and interactive features of a web page such as performing calculations, checking forms, adding special effects, etc.

Like other programming languages, it contains variables, arrays, functions, operators, objects and much more, which can help you create better scripts for your web pages. A scripting language is a language that is generally easy and fast to learn. JavaScript is a client-side language that runs on the client’s browser. It enables your web page to be highly functional as it can be used to validate text fields, disable buttons, validate forms, or change the background color of your pages.

One thing to clear up before going any further is the difference between Java and JavaScript. Some people mistakenly think that JavaScript is the same thing as Java, or that it is a ‘lighter’ version of it, but this is not true. Java is a completely different language and is much more complex then JavaScript. When using Java you have to declare each variable with the type, but with JavaScript you do not need to do that as all variables are declared when you first time use them. Also, with Java you have to declare all variables, functions and classes, but you do not need to do this either with JavaScript.

JavaScript includes commands that allow you to control the content being displayed by the web browser. It can be used to open new documents in a window, or even to return to a previously visited document. Anyone familiar with pop-up advertising windows will be aware of the power of JavaScript. This functionality can be very helpful for navigating sites and guiding the users to the appropriate area.

Data processing is another function made easier with JavaScript as it can validate form data. It can also be used to create things like mortgage or loan calculators. It is very good at doing mathematical computations, generation random numbers, and performing most other typical computational actions. It can process data so well because of its ability to interact with the form. A typical web site calculator running JavaScript is very useful when people want to play around with the numbers before submitting them.

Another way that JavaScript can interact with forms is by validating the data before it is submitted in an online form. This is accomplished by making sure certain required fields have been filled in. It can also be used to verify the information is in the correct format. For instance, it can make sure that you do not have alphabetic characters in a phone number field. It can also be used to keep track of someone shopping online and store information about what they want to buy until they are ready to check out.

JavaScript is useful for occasions when it is important to save information about a web browsing session. This ‘saving state’ function is the process of saving the current state of an ongoing transaction. For instance, if you are shopping online, it is important for the web site to know who you are, and to remember what you wanted to buy.

For security reasons, JavaScript is normally not allowed to read or write files on the client computer. However, it can generate data strings that the web browser can store in a special file commonly referred to as a ‘cookie’. The cookie is a configuration file that provides information on how to set up the browser. Web browsers cannot read or write local files without explicit permission, but they can alter their own configuration files (cookies). This is how web browsers keep track of the sites you have visited, and allow you to set your own browsing preferences.

One major drawback to using JavaScript is that validating and processing an online form can sometimes take a long time to download and a long time to run. Scripts that take too long may convince the user that the page has locked up, causing them to try to refresh it, or to click on the submit button repeatedly. Both of these actions could be problematic as it could lead to the page actually being locked up. Anyone entering personal or financial information will be uncomfortable using a page that appears to lock up on them; so some kind of warning may be needed.


Print this Article Email to a Friend



Community

Join our forums and be part of our growing community
   

Related Articles