Expressing yourself in JavaScript
Expressions tell JavaScript what to do with the data you provide, and are most commonly used in for, if, and while statements. Expressions are also used to perform basic math functions using JavaScript. In these ways, JavaScript can keep track of what's going on around it, testing for and storing important information it might need later. (3,100 words)
Gordon Mccomb, April 1997

More frequently sought solutions
Most JavaScripters have the wits and creativity to write almost any program they can imagine. However, wits and creativity can only get you so far. Unfortunately, many JavaScript writers know where they want to go, but they just don't know how to get there. To bridge this gap, I'm devoting this month's JavaScript to providing the answers you need most.
Gordon Mccomb, March 1997

Create reusable routines in JavaScript
Most JavaScript programs are constructed using common building blocks, or routines. Routines can be encapsulated into self-contained functions that are then cut and pasted between JavaScript programs. As you develop in JavaScript, you can save your routines and create a library of common functions. When you need a particular function, simply copy the function into your current project. You don't have to rewrite everything from scratch. (4,025 words)
Gordon Mccomb, February 1997

Take advantage of user-defined variables in JavaScript
As with all programming languages, JavaScript relies heavily on user-defined variables. But unlike many languages -- including Java -- JavaScript's system of variables is simplified, so that even users with minimal programming experience can immediately use them. JavaScript doesn't impose strict data formats or types for its variables, which can greatly simplify programming. However, just because JavaScript's variables are easy to use doesn't mean they lack power. (3,100 words)
Gordon Mccomb, January 1997

Understanding and using JavaScript statements
Commands, constructs, statements -- whatever the term -- these are the real workhorses of any programming language. JavaScript supports a small collection of statements, including the usual if, while, and for, that you use to build intelligent applications. Combined with objects, properties, methods, and events, statements round out the JavaScript program, giving it direction, purpose, and logic. (4,250 words)
Gordon Mccomb, December 1996

Frequently sought solutions
As any service station attendant will tell you, people always ask the same questions: "Where's the bathroom?" "How do I get onto the interstate?" It's no different when working with programming languages. Most questions asked about accomplishing some task in JavaScript follow the common threads. Learning the solutions to the most popular questions helps you to get better acquainted with JavaScript.
Gordon Mccomb, November 1996

New JavaScript features in Navigator 3.0
Change is inevitable. And on the Internet that change comes quickly. Netscape has released version 3.0 of its phenomenally popular Navigator browser software, and with this new version comes changes in the way JavaScript works. In some cases, 3.0 fixed bugs that exist in JavaScript for Netscape 2.0, and in other cases, 3.0 added new functions. And in a few cases, changes to the way Netscape 3.0 works make JavaScript programs for 2.0 inoperative.
Gordon Mccomb, October 1996

Netscape introduces new 'privacy' bug
Often it's the smaller, gopher-sized holes that escape the attention of the paid hackers and Netscape's security team. But these can be just as dangerous as the gaping bear pits you read about here and in the newspapers. For example, version 2.0 of Navigator was well out the door when it was discovered that a seeemingly bit of innocuous JavaScript code could enable any Web site administrator to collect e-mail names of all visitors. The code was as simple as this:
Gordon Mccomb, October 1996

'Personalized JavaScript': User-defined functions, objects, and methods
The power of any programming language depends on the extent to which you can modify it for your own needs. The more you are limited to using just the built-in commands and processes, the more you are limited in what you can do with that language. And the harder it is to write sophisticated programs. Thankfully, JavaScript supports user-defined functions, properties, and methods, and uses a simplified object model to create them. (3,400 words)
Gordon Mccomb, September 1996

Using JavaScript and graphics
Graphics lend a multimedia edge to HTML documents. JavaScript extends the features of graphics in HTML pages by making image selection and appearance dynamic. With just a moderate amount of JavaScript coding, it's possible to conditionally choose graphic files for use on a page, resize and distort images, and even create images on the fly.
Gordon Mccomb, August 1996

Is JavaScript here to stay?
JavaScript is at a crossroads. Though less than a year old, JavaScript is already feeling growing pains as it strives to keep up with the fast pace of new versions of Netscape Navigator. A number of unresolved issues remain, and if left alone any of these issues could spell the doom of JavaScript as the standard- bearer of user-scripting languages for Web pages. (2,000 words)
Gordon Mccomb, August 1996

Debugging JavaScript programs
Everyone makes mistakes writing JavaScript programs. Errors don't know experts from novices, so the next time you get an error message while trying to play a JavaScript program you've written, don't feel bad. JavaScript provides error messages as a means to help you spot mistakes. This column describes the errors you are likely to get when writing a JavaScript program and what to do about them.
Gordon Mccomb, July 1996

Using JavaScript and forms
Javascript wears many hats. You can use JavaScript to create special effects. You can use JavaScript to make your HTML pages "smarter" by exploiting its decision-making capabilities. And you can use JavaScript to enhance HTML forms. This last application is of particular importance. Of all the hats JavaScript can wear, its form processing features are among the most sought and used.
Gordon Mccomb, June 1996

Using JavaScript's built-in objects
JavaScript sports a number of built-in objects that extend the flexibility of the language. These objects are Date, Math, String, Array, and Object. Several of these objects are "borrowed" from the Java language specification, but JavaScript's implementation of them is different. If you're familiar with Java, you'll want to carefully examine JavaScript's built-in object types to avoid any confusion.
Gordon Mccomb, May 1996

Bending over backward to make JavaScript work on 14 platforms
JW: How long have you been on the Navigator 2.0 project?
Rawn Shah, April 1996

Newsletter sign-up
View all newsletters

Enterprise Java Newsletter
Stay up to date on the latest tutorials and Java community news posted on JavaWorld