Chapter 1
The Top Ten Things You Need To Know
You can't turn on the television, open a magazine or newspaper, or listen to the radio without hearing about it. If your work involves computers (even if you're not a programmer), you might even have to deal with it. You may even find it creeping into the conversation at parties. It has become a force of its own, and it's gaining momentum: The World Wide Web is everywhere. More and more companies have home pages; they even advertise them on their commercials. In fact, "the Web" has gotten so big that a whole new occupation has popped up in the Sunday classifieds: Web Page Designer.
In the early days of the Web, you had to be a mainframe guru (those strange folks who prowl the company computer networks late at night, speaking a language unto themselves) to even begin to understand how to create beautiful pages. You had to use HTML, CGI, Perl, and other "computer-ese" languages.
The times they are a-changin'. And leading the pack is a new kid on the block. A language that's simple, yet powerful. Elegant, yet practical. Enter JavaScript: Web programming for the common man. That's what you're here to look at-what you're here to learn.
I know most of you never pictured yourself sitting down and reading a book on computers from cover to cover. I hope I can change your mind. Here's a quick look at some things you'll need to know to get started in the wonderful world of JavaScripting:
1. JavaScript Is New--I Mean New
Created by Sun Microsystems and Netscape, JavaScript isn't totally defined yet (some parts still need hashing out by the experts). The parts that are finished give you a great deal of power and control, but if you want to keep up with the language as it evolves, you'll need to stop by Sun's or Netscape's home pages from time to time. An excellent starting place would be:
http://home.netscape.com/comprod/products/navigator/version_2.0/script/_script_info/index.html
2. JavaScript Is Strictly for the World Wide Web
JavaScript was created in an effort to give Web authors more power and flexibility without driving them over the brink with programming syntax, language structure, and other dull things. To see how JavaScript fits into the Web scheme, check out Chapter 2.
With JavaScript, it's much easier to create a Web page that interacts with the user. For example, imagine a page where the user enters purchase orders. Using JavaScript, the page can easily make given calculations based on the customer's order and display an immediate on-screen invoice. Some experienced Web surfers may think, "Sure, I've seen that before JavaScript." It's true that this form of user interactivity has been possible before, but JavaScript makes it easier for everyone to implement-especially the novice or amateur Web page designer-and it requires fewer computing resources to do so.
3. JavaScript Is a Scripting Language
This is a fancy term for something that isn't quite a programming language but is more than the language currently used to create Web pages: HTML.
HTML is technically a "markup" language. It basically serves to mark out sections of text that should appear in a certain style. This is quite a bit different from a "programming" language, which is a set of grammatical statements and rules that can be combined to give instructions to the computer. A "scripting" language is something of a hybrid of the two, although it's closer to a programming language. In short, a scripting language serves the same purpose as a programming language (to provide a series of instructions to the computer), but its rules are less strict and less complex. Scripting languages are best suited for small programming tasks, such as those you would need in a Web page (as opposed to, say, creating a word processing program such as Microsoft Word).
4. To See the Magic That JavaScript Can Produce, You Need a Browser That Can Handle It: Netscape Navigator 2.0
Currently, there is only one browser available that takes advantage of JavaScript's power: Netscape Navigator 2.0. As time goes on, other browsers will appear that support it, but for now, Navigator 2.0 is the only game in town. Chapter 3 shows you how to track down and install your very own copy of this nifty little program.
5. You Can "Borrow" JavaScript Programs from Other People's Web Pages
Since JavaScript is embedded within HTML documents, you can surf the Web and actually see the code that other scripters have created. You'll do some poking around the Internet in Chapter 5, checking out the hottest spots for nifty scripts.
6. JavaScript Is a Language That Extends HTML; You Stick It into Your Pages Using the <SCRIPT> Tag
JavaScript has a lot packed into it (objects, functions, events, and such), but everything is designed to be easy to use and understand. As a "little sister" to Java, the new full-blown Web programming language, JavaScript gives you most of Java's power without you having to grease your hair back, switch to a plaid shirt and high-water pants, and buy a gross of pocket protectors. Chapter 4 covers how JavaScript works in conjunction with HTML.
7. With JavaScript, You Can Bypass Mastering CGI
JavaScript makes it possible to do things you couldn't do before without learning CGI (the esoteric UNIX-based programming interface to the World Wide Web). Some things will still require CGI access (you'll look at them more closely in later chapters), but for the most part, you won't need it.
8. JavaScript Is Built Around the Concept of Objects
JavaScript requires you to think objectively. By that, I mean that the language is built around the concept of objects or "things that represent other things." The nuts and bolts of what makes up JavaScript are covered in Chapters 6 through 14.
9. Learning JavaScript by Example Is the Easiest Approach
Learning a new language is tough. Take it slow, go easy, take small bites, and above all, try things. In this book, you'll find several examples of JavaScript, complete with full HTML documents that you can type in and run "right out of the box." If you want to jump right to the examples, you'll find them in Chapters 15 through 18.
10. If You Can Imagine It, JavaScript Can Help You Create It
Covering everything that makes up JavaScript would take a much larger (and more boring) book than the one you're holding. The intention here is to give you a taste of the power of this new language. By the time you're done with the coming chapters, you'll be able to craft some pretty impressive pages, and you'll have enough ideas to keep yourself scripting for some time to come. If you still need some help with ideas, Chapter 19 has a bunch.



For comments or technical support for our books and software, select Talk to Us.
To order books, call us at 800-716-0044 or 317-228-4366.
© 1996, QUE Corporation, an imprint of Macmillan Publishing USA, a Simon & Schuster Company.