The Complete Idiot''''s Guide to Javascript potx

291 1.1K 0
The Complete Idiot''''s Guide to Javascript potx

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Complete Idiot's Guide to JavaScript 2nd Edition The Complete Idiot's Guide to JavaScript 2nd Edition- Online Version By Aaron Weiss Buy This Book The complete book is online here! Price: $19.99 USA Explore the book by using the Table of Contents and linking directly 350 Pages to the chapters that interest you ISBN: 0-7897-1136-2 | Que's Digital Bookshelf Home Page | Que Home Page | For comments or technical support for our books and software, select Talk to Us Copyright © 1997, QUE Corporation, an imprint of Macmillan Publishing USA, a Simon and Schuster Company file:///G|/kk/!start_here.htm [31/03/2002 11:57:58] Complete Idiot's Guide to JavaScript Complete Idiot's Guide to JavaScript, Second Edition Credits Copyrights We'd like to hear from you! Contents at a glance Introduction Dedications Part 1: What's It All About? Chapter 1: Coffee? In My Computer? I Prefer Decaf Chapter 2: Navigator and Explorer: The World Wide Web on a Caffeine High Part 2: Let's Get Jivin' Chapter 3: Tag You're It! Chapter 4: Off and Running With Someone Else's Help Part 3: JavaScript: Espresso for the Masses Chapter 5: Objects, Names, and Literals Chapter 6: Operators and Expressions Chapter 7: Making a Statement Chapter 8: Conjuction Junction, What's a Function? Chapter 9: An Eye on Events Chapter 10: How Much Is That Object in the Window? Chapter 11: Mapping and Tracking: Locations and Histories Chapter 12: The Document Shuffle Chapter 13: Fiddling with Forms and Emulating Events Chapter 14: Navigating with Navigator Chapter 15: "Array" (A Ray) of Organization Chapter 16: Image-ine That! Chapter 17: Care for a Cookie? Part 4: Scripting the Whole Bean file:///G|/kk/toc.htm (1 de 2) [31/03/2002 11:58:02] Complete Idiot's Guide to JavaScript Chapter 18: Script Example 1: Hello World! Chapter 19: Script Example 2: Random Chatter Chapter 20: Script Example 3: Which Way Do We Go? Chapter 21: Script Example 4: Loan Calculator Chapter 22: Script Example 5: BlackJack Chapter 23: Script Example 6: Creating an eZine Chapter 24: Script Example 7: Welcome Back! Chapter 25: What to Do When It Won't Work: Debugging Your Scripts Chapter 26: Ideas Chapter 27: Stepping Up to Straight Java Appendix A: JavaScript: The Complete Overview Appendix B: Speak Like a Geek: The Complete Archive 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 © 1997, QUE Corporation, an imprint of Macmillan Publishing USA, a Simon & Schuster Company file:///G|/kk/toc.htm (2 de 2) [31/03/2002 11:58:02] Complete Idiot's Guide to Java Script 2e The Complete Idiot’s Guide to JavaScript, Second Edition by Aaron Weiss A Division of Macmillan Computer Publishing 201 West 103rd Street, Indianapolis, IN 46290 USA “Homer, have you been up all night eating cheese?” —Marge Simpson Copyrights 1997 Que Corporation All rights reserved No part of this book shall be reproduced, stored in a retrieval system, or transmitted by any means, electronic, mechanical, photocopying, recording, or otherwise, without written permission from the publisher No patent liability is assumed with respect to the use of the information contained herein While every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions Neither is any liability assumed for damages resulting from the use of the information contained herein For information, address Que Corporation, 201 West 103rd Street, Indianapolis, IN 46290 You can reach Que's direct sales line by calling 1-800-428-5331 Library of Congress Catalog Card Number: 96-72292 International Standard Book Number: 0-7897-1136-2 99 98 97 Interpretation of the printing code: the rightmost double-digit number is the year of the book's first printing; the rightmost single-digit number is the number of the book's printing For example, a printing code of 97-1 shows that this copy of the book was printed during the first printing of the book in 1997 Screen reproductions in this book were created by means of the program Collage Complete from Inner Media, Inc, Hollis, NH Printed in the United States of America Credits file:///G|/kk/info.htm (1 de 9) [31/03/2002 11:58:07] Complete Idiot's Guide to Java Script 2e Publisher Roland Elgey Publishing Director Lynn E Zingraf Editorial Services Director Elizabeth Keaffaber Managing Editor Michael Cunningham Director of Marketing Lynn E Zingraf Acquisitions Editor Martha O'Sullivan Technical Specialist Nadeem Muhammed Product Development Specialist John Gosney Technical Editor Kyle Bryant Production Editor Audra Gable Book Designer Barbara Kordesh Cover Designer Dan Armstrong HTML Conversion Dave Galante We'd Like to Hear from You! file:///G|/kk/info.htm (2 de 9) [31/03/2002 11:58:07] Complete Idiot's Guide to Java Script 2e As part of our continuing effort to produce books of the highest possible quality, Que would like to hear your comments To stay competitive, we really want you, as a computer book reader and user, to let us know what you like or dislike most about this book or other Que products You can mail comments, ideas, or suggestions for improving future editions to the address below, or send us a fax at 317-581-4663 For the online inclined, Macmillan Computer Publishing has a forum on CompuServe (type GO QUEBOOKS at any prompt) through which our staff and authors are available for questions and comments The address of our Internet site is http://www.mcp.com/que (World Wide Web) In addition to exploring our forum, please feel free to contact me personally to discuss your opinions of this book: I'm 104436,2300 on CompuServe, and I'm jgosney@que.mcp.com on the Internet Note: Although we cannot provide general technical support, we're John Gosney happy to help you Product Development Specialist resolve problems Que Corporation you encounter 201 West 103rd Street related to our Indianapolis, Indiana 46290 books, disks, or USA other products If you need such assistance, please contact our Tech Support department at 800545-5914 ext Part 1: What’s It All About? 3833 To order other Coffee? In My Computer? I Prefer Decaf Que or Macmillan What is JavaScript, and how does it fit into the Internet scheme of things? Computer What can JavaScript for you and to you and why you’d ever want to Publishing books it or products, please call our Customer Service Navigator and Explorer: The World-Wide Web on a Caffeine High department at 800Both Netscape Navigator and Microsoft Internet Explorer support 835-3202 ext JavaScript Here you download, install, and get each browser up and 666 Thanks in advance—your comments will help us to continue publishing the best books available on computer topics in today's market Contents at a Glance file:///G|/kk/info.htm (3 de 9) [31/03/2002 11:58:07] Complete Idiot's Guide to Java Script 2e running and then take a walk on the JavaScript side! You also get your first exposure to some of the differences between Navigator and Explorer and how they handle JavaScript Part 2: Let’s Get Jivin'! Tag You’re It! JavaScript is incorporated into World Wide Web pages through a new HTML tag Here I introduce the tag and show you how easy it is to “jive up” your pages Off and Running With Someone Else’s Help The fastest way to get started with JavaScript is to “borrow” from the growing collections of scripts other Jivers have made available for you Part 3: JavaScript: Espresso for the Masses Objects, Names, and Literals JavaScript is built around objects—things that correspond to the various parts of an HTML document Before you get down and dirty, you need to look at the basic pieces that make up JavaScript (or any scripting language) Operators and Expressions Just as you can combine values in math, JavaScript allows you to things to variables through operators A combination of operators and variables that yields a specific result is an expression I’ll show you how simple it is to “express yourself” with JavaScript Making a Statement Create an expression and then assign its value to another variable—and you’ve just created a JavaScript statement Statements are the individual steps that make up a JavaScript process Conjunction Junction, What's a Function? A bunch of statements that work together to perform a particular purpose can be grouped as a function In this chapter, I show you how easy it is to “roll your own.” An Eye on Events JavaScript allows you to react to things that the user does, like clicking a button, submitting a form, or selecting a URL In tech-speak, this is called “responding to an event,” and it’s easy to with JavaScript 10 How Much Is That Object in the Window? The window object is the “top-level” object, from which all other objects derive You’ll create a couple to see how they work 11 Mapping and Tracking: Locations and Histories file:///G|/kk/info.htm (4 de 9) [31/03/2002 11:58:07] Complete Idiot's Guide to Java Script 2e Browsers have history lists, which keep track of the URLs you’ve visited You can access your user's history (and send the user to different places automatically) with the Location and History objects 12 The Document Shuffle The document object provides a way of controlling how a Web page looks You’ll learn what makes up the document object and how you can manipulate it 13 Fiddling with Forms and Emulating Events The form object is a part of a document (just as the tag is part of an HTML page) You’ll take a look at it and learn how to control and change it through JavaScript 14 Navigating with Navigator The Navigator object gives you a good deal of information about the user's browser I’ll show you how you can use this information to customize your site 15 Image-ine That! A new object addition to the JavaScript family is the Image object With the Image object, you can now change the graphic displayed within an tag—without having to reload the entire page! 16 "Array" (A Ray) of Organization The array object enables you to organize your JavaScript data into easily manageable blocks Here I’ll show you how to set up your own JavaScript-based database, as well as a trick for creating arrays that work with older versions of JavaScript 17 Care for a Cookie? Cookies are ways of storing information about a user from visit to visit You can access (and manipulate) this information from within JavaScript Part 4: Scripting the Whole Bean 18 Script Example 1: Hello World! A simple introductory script that displays a line of text on the page—with a couple JavaScript twists 19 Script Example 2: Random Chatter Computers aren’t random by nature, but they can be made to seem random You’ll learn how to get your JavaScript pages to change at the click of a mouse 20 Script Example 3: Which Way Do We Go? While JavaScript is quickly growing in popularity, not everyone uses browsers that support it This example shows how you can use JavaScript to automatically guide users through your site (depending on what their browsers can handle) file:///G|/kk/info.htm (5 de 9) [31/03/2002 11:58:07] Complete Idiot's Guide to Java Script 2e 21 Script Example 4: Loan Calculator Time to figure out how much you’ll have to pay for that fancy new computer Before JavaScript, this required some pretty sophisticated HTML and CGI tricks Now it’s a snap! 22 Script Example 5: BlackJack JavaScript isn’t all fun and games but it does a good job of gambling Using a couple of techniques from previous scripts, you can put together your own JavaScript casino 23 Script Example 6: Creating an eZine If you’ve ever wanted to speak your mind on the Web, here’s the perfect way to start: a complete framework for creating an online eZine in HTML with JavaScript enhancements 24 Script Example 7: Welcome Back! A site that's warm and welcoming is sure to get repeat visitors This example demonstrates how to use cookies to keep track of how many times a given user has visited your site 25 What to Do When It Won’ t Work: Debugging Your Scripts Troubleshooting and preventive measures to make sure that visitors to your JavaScriptpowered page see exactly what you intend for them to see 26 Ideas If you’ve made it this far and haven’t started dreaming about the other things you can with JavaScript, here are a few ideas to get the creative juices flowing 27 Stepping Up to Straight Java Now that you know how JavaScript works, here’s what you’ll have to if you want to learn the full-featured language that inspired JavaScript Learn how to manipulate Java applets from JavaScript code! Appendix A: JavaScript: The Complete Overview An excellent "all-in-one-place" reference, listing the objects, methods, properties, and events that make up the JavaScript language, as well as some predefined JavaScript colors and the "reserved words" that you mustn't use for variable names Appendix B Speak Like a Geek: The Complete Archive Your one-stop shop for all the JavaScript-related techno-talk you need to be the life of your next party Introduction file:///G|/kk/info.htm (6 de 9) [31/03/2002 11:58:07] Complete Idiot's Guide to Java Script 2e Welcome to The Complete Idiot's Guide to JavaScript, Second Edition! The Complete Idiot's Guide to JavaScript introduces you, gentle reader, to the hottest property in cyberspace today: JavaScript With JavaScript, a normal, everyday, Internet-familiar person can create Web pages with the finesse of an experienced guru No mantras, no strange languages, and no expensive compilers are necessary—just a little common sense and an open mind This book explains what JavaScript is, how it works, what it's made of, and how you can use it As a second edition, it also brings you up-to-date on the new features introduced in JavaScript 1.1 You'll discover the component parts that make up this language and come to understand all the esoteric pieces in a language that don't require a Ph.D You'll even find several examples of JavaScript scripts in action that you can rip apart, change, and enhance What about the title of this book: The Complete Idiot's Guide? Well, it assumes that you're no idiot on your own turf You know your job, you know what you want, you know how to get things done But there's one thing you don't know: how to use JavaScript This book assumes that you've done a little Web surfing and have created some of your own Web pages However, as you've surfed, you've come across things others have put together, and you want to learn how to that, too The underlying things (protocols, transmission layers, gateways, proxies) are of little concern to you; you just want to get the job done—quickly and easily—and at the same time, retain as much of your hair as possible Here are some more assumptions, I’ve taken the liberty to make: q q q q q You know what the World Wide Web is You know what a browser is You're familiar with HTML, the language of the Web You've created some of your own Web pages You like chocolate If, however, you feel you want more background on any of these assumptions, check out The Complete Idiot's Guide to the Internet (Peter Kent), The Complete Idiot's Guide to the Internet with Windows 95 (Peter Kent), The Complete Idiot's Guide to Creating an HTML Web Page (Paul McFedries), or The Complete Idiot's Guide to the World Wide Web (Peter Kent) How Do You Use This Book? You don't have to read this book from cover to cover If you want to find out what makes up JavaScript, go to the JavaScript internals chapters, Chapters through 17; if you want to dive right in and start creating script pages, go to the examples chapters, Chapters 18 through 24 Each chapter is a self-contained unit with the information you need in order to use and understand one aspect of JavaScript If you require information that's covered elsewhere in the book, you'll find plenty of crossfile:///G|/kk/info.htm (7 de 9) [31/03/2002 11:58:07] file:///G|/kk/17fig01.jpg file:///G|/kk/17fig01.jpg [31/03/2002 12:07:26] file:///G|/kk/17fig02.jpg file:///G|/kk/17fig02.jpg [31/03/2002 12:07:32] file:///G|/kk/18fig01.jpg file:///G|/kk/18fig01.jpg [31/03/2002 12:07:45] file:///G|/kk/18fig02.jpg file:///G|/kk/18fig02.jpg [31/03/2002 12:07:53] file:///G|/kk/18fig03.jpg file:///G|/kk/18fig03.jpg [31/03/2002 12:07:57] file:///G|/kk/19fig01.jpg file:///G|/kk/19fig01.jpg [31/03/2002 12:08:17] file:///G|/kk/21fig01.jpg file:///G|/kk/21fig01.jpg [31/03/2002 12:08:28] file:///G|/kk/21fig02.jpg file:///G|/kk/21fig02.jpg [31/03/2002 12:08:43] file:///G|/kk/22new01.jpg file:///G|/kk/22new01.jpg [31/03/2002 12:09:06] file:///G|/kk/24fig01.jpg file:///G|/kk/24fig01.jpg [31/03/2002 12:09:34] file:///G|/kk/24fig02.jpg file:///G|/kk/24fig02.jpg [31/03/2002 12:09:38] file:///G|/kk/26fig02.jpg file:///G|/kk/26fig02.jpg [31/03/2002 12:09:49] file:///G|/kk/27fig02.jpg file:///G|/kk/27fig02.jpg [31/03/2002 12:10:11] file:///G|/kk/27fig03.jpg file:///G|/kk/27fig03.jpg [31/03/2002 12:10:19] file:///G|/kk/27fig04.jpg file:///G|/kk/27fig04.jpg [31/03/2002 12:10:29] ... Welcome to The Complete Idiot''s Guide to JavaScript, Second Edition! The Complete Idiot''s Guide to JavaScript introduces you, gentle reader, to the hottest property in cyberspace today: JavaScript. .. Guide to the Internet (Peter Kent), The Complete Idiot''s Guide to the Internet with Windows 95 (Peter Kent), The Complete Idiot''s Guide to Creating an HTML Web Page (Paul McFedries), or The Complete. .. AS total = total — price; total *= price; SAME AS total = total * price; total /= price; SAME AS total = total / price; total %= price; SAME AS total = total % price; (see arithmetic operator

Ngày đăng: 06/03/2014, 00:20

Từ khóa liên quan

Mục lục

  • Disco local

    • Complete Idiot's Guide to JavaScript 2nd Edition

    • Complete Idiot's Guide to JavaScript

    • Complete Idiot's Guide to Java Script 2e

    • Complete Idiot's Guide to JavaScript

    • Complete Idiot's Guide to JavaScript

    • Complete Idiot's Guide to JavaScript

    • Complete Idiot's Guide to JavaScript

    • Complete Idiot's Guide to JavaScript

    • Complete Idiot's Guide to JavaScript

    • Complete Idiot's Guide to JavaScript

    • Complete Idiot's Guide to JavaScript

    • Complete Idiot's Guide to JavaScript

    • Complete Idiot's Guide to JavaScript

    • Complete Idiot's Guide to JavaScript

    • Complete Idiot's Guide to JavaScript

    • Complete Idiot's Guide to JavaScript

    • Complete Idiot's Guide to JavaScript

    • Complete Idiot's Guide to JavaScript

    • Complete Idiot's Guide to JavaScript

    • Complete Idiot's Guide to JavaScript

Tài liệu cùng người dùng

Tài liệu liên quan