Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (3.05 MB, 7 trang )
<span class='text_page_counter'>(1)</span><div class='page_container' data-page=1>
Learn JavaScript In a Weekend, 2nd Edition is the ultimate guide to integrating
JavaScript into Web pages. With step-by-step instructions, readers will learn how to
effectively use JavaScript, the most popular scripting language used for Web
development today. Setting itself apart from competitors, this is the only beginner-level
book to cover both JavaScript and Jscript. The author includes an introduction to
computer and network automation using JScript. To enforce the material covered
throughout the book, there are a number of new scripts introduced and available for
download on the book's companion Web site.
Features
• Covers the most current versions of JavaScript (Version 1.5) and JScript (Version
5.6). Much of the competition still focuses on previous versions of these
languages.
• Incorporates the latest versions of Netscape and Internet Explorer while much of
the competition still focuses on previous versions of these browsers.
• The author differentiates the book from its competition by also covering JScript
and its role as a WSH scripting language. JavaScript will entail about 70% of the
book, while about 30% will be dedicated to JScript.
• Table of Contents
Dedication
ACKNOWLEDGMENTS
ABOUT THE AUTHOR
Introduction
What This Book Is About
Who Should Read This Book?
Chapter FRIDAY EVENING. Introducing JavaScript and JScript
Introducing JavaScript and JScript
What Kinds of Things Can You Do with JavaScript and JScript?
A Little History Lesson
JavaScript and Browser Compatibility
Integrating JavaScript with HTML
JavaScript and Case Sensitivity
Different Ways to Integrate JavaScript into Your HTML Pages
Taking a Break
Introducing JScript
What's Next?
Chapter SATURDAY MORNING. Learning the Basics of JavaScript Coding
A Few Words about Scripting
Working with Values
Take a Break
JavaScript and JScript Statements
Streamlining Your Scripts with Functions
Using Arrays
Object-Based Programming
Working with Built-In Objects
What's Next?
Chapter SATURDAY AFTERNOON. Using JavaScript to Build Better Web Pages
Working with Browser-Based Objects
A Brief Overview of Browser Object Models
Browser Objects
Creating Custom Objects
Handling Events
Take a Break
Using JavaScript to Manage Frames
Using JavaScript to Manage Forms
What's Next?
Chapter SATURDAY EVENING. Doing Really Cool Things with Your Web Pages
Controlling the Status Bar
Taking Advantage of Dialog Boxes
Take a Break
Working with Different Types of Browsers
Other Neat Stuff
Basic Graphics and Animation
Chapter SUNDAY MORNING. Advanced JavaScript Coding
Baking JavaScript Cookies
Debugging Your JavaScripts
Take a Break
Overview of the On-line Bookmall Web Site
Crafting the Index Page
The Featured Book
Navigating the Bookmall
Finishing the Bookmall
Receiving Customer E-Mail
What's Next?
Chapter SUNDAY AFTERNOON. Learning How to Use JScript and the WSH
An Overview of the WSH Object Model
JScript Runtime Objects
Take a Break
Working with the Windows File System
Opening and Closing Files
Creating Report and Log Files
Processing File Contents
Administering Files and Folders
Chapter SUNDAY EVENING. Using JScript to Automate Windows Tasks
Automating Windows Desktop Tasks
Executing Windows Commands
Working with Networks and Network Resources
Taking a Break
Interacting with the Windows Registry and Application Event Log
Automating Script Execution
What's Next?
What's on the Web Site?
Integrating JavaScript with HTML
To Alexander, William, Molly, and Mary.
There are a number of individuals who deserve a lot of credit for the effort that they put
into this book. I especially want to thank Arlie Hartman who served as the book's
acquisitions editor. I also want to thank the book's project editor, Kim Benbow, for her
guidance and suggestions. Finally, I want to acknowledge the book's copy editor, Gene
Redding, and its technical editor, Burt LaFontaine, as well as everyone else at Premier
Press for all their hard work.
Congratulations on your decision to learn JavaScript and JScript. JavaScript is a powerful
scripting language that, when combined with HTML, allows you to create exciting and
powerful Web pages. You can use these Web pages to run a small business or to share
information with family and friends over the Internet. JScript is a Microsoft
implementation of JavaScript that can be used as a scripting language for automating
repetitive or complex desktop and system tasks.
What you are probably asking yourself is, "Can I really learn to program using JavaScript
and JScript in a single weekend?" The answer is "Yes!" I am not promising that you will
become a programming guru in just a few days, but if you will dedicate a full weekend to
this book and follow along with its examples, you will be able to write your own
JavaScripts and JScripts. In no time you will be able to make dramatic improvements to
your Web pages as well as develop scripts that automate any number of Windows desktop
tasks.
Syntactically, JavaScript and JScript are virtually identical. So by learning how to write
JavaScripts, you are also learning how to work with JScript as well. Where the two
languages differ is in the environments in which they execute. JavaScripts are embedded
inside HTML pages and run by Web browsers. JScripts, on the other hand, are written as
plain text files that are executed directly from the Windows desktop by the Windows
Script Host or WSH.
As long as you have basic Windows skills and a good HTML background, you'll find that
this book will provide you with all the information and examples you need to get up and
running with both of these exciting scripting languages in a single weekend.
This book is about learning how to write JavaScripts in order to create exciting Web sites.
It is also designed to teach you how to leverage the skills and knowledge that you'll
develop working with JavaScript in order to create JScripts that automate desktop tasks.
Basic experience with Windows and HTML is assumed. The book provides the rest for
you. By the time the weekend is over, you will have learned how to do the following:
• Integrate JavaScripts into your Web pages
• Use JavaScript to take control of the browser status line
• Use JavaScript to display pop-up alert, prompt, and confirmation dialog boxes so
that you can interact with your visitors
• Use JavaScript to add graphic effects to Web pages
• Use JavaScript to create Web page banners, clocks, and other animation effects
• Use JavaScript to validate forms and e-mail the contents of those forms to
yourself
12. If you selected the When I Log On option, you will be prompted to provide the
following information:
o <b>Enter the user name.</b> Sets the name of a user account whose security
privileges should be used when running the task.
o <b>Enter the password.</b> Sets the account's password.
o <b>Confirm password.</b> Confirms the account's password.
Make your selections and click on Next, and then skip to step 14.
13. The wizard then prompts you to provide the following information:
o <b>Enter the user name.</b> Sets the name of a user account whose security
privileges should be used when running the task.
o <b>Enter the password.</b> Sets the account's password.
o <b>Confirm password.</b> Confirms the account's password.
14. Click on Finish.
Once created, the new scheduled task is stored in the Scheduled Tasks folder, as shown in
Figure 7.20.
JScript. Most important of all, start writing your own scripts. There is no better way to
learn than by doing. Good luck!
To save you the time and effort required to re-key all of the examples that you have seen
in this book, copies of each script are available for download from
as shown in Figure D.1.