Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


What is JavaScript?

April 26, 2002

JavaScript started life as LiveScript, but Netscape changed the name, possibly because of the excitement being generated by Java, to JavaScript. The name does confuse people, though, who expect there to be a closer relationship between Java and JavaScript than actually exists. In fact there's little in common between the languages, although some of the syntax looks similar.

The JavaScript language was created by Netscape in 1996 and included in their Netscape Navigator (NN) 2.0 browser via an interpreter that reads and executes the JavaScript included in .html pages. The language has steadily grown in popularity since then, and is now supported by the most popular browsers: those produced by Netscape and Microsoft as well as less widely used browsers like Opera. The good news is that this means JavaScript can be used in web pages for all major modern browsers. The not quite so good news is that there are differences in the way the different browsers implement JavaScript, although the core JavaScript language is much the same.

The great thing about JavaScript is that once you've learned how to use it for browser programming, you can move on to use it in other areas. Microsoft's IIS uses JavaScript to program server-side web pages, PDF files now use JavaScript, and even Windows admin tasks can be automated with JavaScript code.

What Can JavaScript Do for Us?

The rollovers and DHTML tricks associated with JavaScript came along relatively recently in the history of the technology. In the early days JavaScript was primarily used for manipulating data before posting it to the server, saving the contents of a form as the user moved from one page of an application to another, and client-side form validation – in fact, much of the functionality that it's widely used to implement now.

Validating the user's data simply means checking that the data entered is appropriate before proceeding with the form. For example, if you want the user to enter a date in the format dd/mm/yy, then you can check that numbers and not letters have been entered, and that the numbers make sense: that the number representing the day isn't higher than 31, and that the number representing the month isn't higher than 12.

There are two very good reasons for validating data on the client's machine:

· User experience: the user doesn't have to wait for the form to be sent to the server, checked for validity, and then possibly sent back with error messages. Validating data on the client makes for a much smoother user experience.

· Server processing power: you're generating far less work for the computer hosting the web site by checking forms before they are sent to the server. The hosting machine won't have to handle the workload of validating the data and resending pages with errors in them to the user. Data checking on the server, although sometimes necessary, uses up bandwidth and will ultimately reduce the maximum number of visitors you can accommodate on your web site at any one time.

Since Netscape Navigator 2 and the first implementation of JavaScript, things have moved on quite a bit. As browsers have become more programmable, developers have been able to create more functional and interactive pages. A simple example of browser programmability in action is the image rollover, where one image is swapped for another when the user rolls her mouse pointer over it. A more sophisticated example is a JavaScript powered shopping cart, something we'll be creating later in the book.

As JavaScript has developed in its own right, developers and designers have been able to create much more impressive visual effects and interaction with the user. For example, JavaScript can be used to create a tree menu for web site navigation, like that one shown below which was on Microsoft's web site (http://msdn.microsoft.com):

This particular example only works in Internet Explorer 4 and above, but it's perfectly possible to create a tree navigation structure that works for Netscape 6+, and we'll be doing later on in the book.

Special effects and inventive interaction can really enhance the user's experience, but they can also really get in the user's way if they are overused or inappropriately placed. It’s the usability enhancements that you can make to your web site using JavaScript that will encourage users to come back again and again.

Practical JavaScript for the Usable Web
Practical JavaScript for the Usable Web
The Advantages and Disadvantages of JavaScript


Up to => Home / Authoring / JavaScript / PracticalJS




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers