index (496)



CONTENTS





Teach Yourself
    VBScript  in 21 Days


by Keith Brophy, Timothy Koets




C  O  N  T  E  N  T  S



Introduction



WEEK 1  At
a Glance

Day
1  Introducing VBScript and the
World Wide Web


The Internet and the World Wide Web
Browsing the World Wide Web

Mosaic
Netscape Navigator
Internet Explorer
Other Browsers

The Elements of the World Wide Web

TCP/IP: The Way Data Moves Through the World Wide Web
HTTP: The Way Data Is Transported Through the World Wide Web
HTML: The Language of the World Wide Web

Extending the World Wide Web with VBScript
Microsoft ActiveX and ActiveX Controls
Extending the World Wide Web with CGI
Summary
Q&A
Workshop
Quiz


Day
2  The Essence of VBScript


What Is VBScript?
What Can VBScript Do?
Some Examples of VBScript in Action

Example #1: The DiscoTec Web Page
Example #2: The Pace Pal
Example #3: The Bird Feeder

Learning VBScript
Security and VBScript
VBScript Versus Visual Basic and Visual Basic for Applications
Summary
Q&A
Workshop
Quiz


Day
3  Extending the Power of Web Pages
with VBScript

How VBScript Enhances Browsers and HTML
Where VBScript Is Supported

Web Browsers
Other Internet Tools

Embedding VBScript in an HTML Document
The Structure of an HTML Document

Important HTML Keywords

Summary
Q&A
Workshop
Quiz


Day
4  Creating Variables in VBScript


What Is a Variable?
How Do I Create a Variable?
What Can Variables Contain?

Boolean
Byte
Integer
Long
Single
Double
Date (Time)
String
Object
Error
Empty
Null

Determining the Type of Data in a Variable

Using VarType
IsDate
IsNumeric
IsEmpty
IsNull
IsObject

Changing the Type of Data in a Variable

CBool
CByte
CDate
CInt
CLng
CSng
CDbl
CStr

Working with Constants
The Scope and Lifetime of a Variable
Working with Arrays
Creating Arrays

Determining the Size of the Array
Multi-Dimensional Arrays
Changing the Contents of the Array

Summary
Q&A
Workshop
Quiz


Day
5  Putting Operators to Work in
VBScript

Working with Operators

Arithmetic Operators
Addition (+)
Subtraction (-)
Multiplication (*)
Division (/ and \)
Exponents (^)
Modulo Arithmetic (Mod)
Negation (-)
Comparison Operators
Equality (=)
Inequality (<>)
Less Than and Greater Than (< and >)
Less Than or Equal To and Greater Than or Equal To (<= and >=)
Object Equivalence (Is)
Logical Operators
Negation (Not)
Conjunction (And)
Disjunction (Or)
Exclusion (Xor)
Logical Equivalence (Eqv) and Implication (Imp)

Working with Strings

String Concatenation (&)
String Concatenation Using the + Operator

Operator Precedence
Summary
Q&A
Workshop
Quiz


Day
6  Controlling the Flow of VBScript
Code

Why Control the Flow of Code?
Using Control Structures to Make Decisions

If…Then
If…Then…Else
Select Case

Using Control Structures to Make Code Repeat

For…Next
Do…Loop

Putting It All Together
Summary
Q&A
Workshop
Quiz


Day
7  Building a Home for Your Code


Subroutines

Declaring a Subroutine
Calling a Subroutine
Exiting a Subroutine

Functions

Declaring a Function
Calling a Function
Exiting a Function

Passing Arguments into Procedures
Why Are Procedures Useful?
Event Procedures
Method Procedures
Procedures, Subroutines, Functions, Events, and Methods!
Where to Put Procedures
Summary
Q&A
Workshop
Quiz



WEEK 1  In
Review

WEEK 2  At
a Glance


Day
8  Intrinsic HTML Form Controls


An Introduction to HTML Forms
The Button Control
The Text Control
The Textarea Control
Putting It All Together
Summary
Q&A
Workshop
Quiz


Day
9  More Intrinsic HTML Form Controls


The Radio Button Control
The Check Box Control
The Password Control
Intrinsic HTML Form Controls at a Glance
Summary
Q&A
Workshop
Quiz


Day
10  An Introduction to Objects and
ActiveX Controls

Objects

Why Objects Are Needed
Object Definition
Object Attributes
Object Parameters

ActiveX Technology

ActiveX Control Overview

The Label Control

Properties, Methods, and Events Supported by the Label

Summary
Q&A
Workshop
Quiz


Day
11  More ActiveX Controls

The New Item Control

Object Definition
Attributes
Properties
Methods and Events
Setting Properties for the New Item Control
Dynamically Adjusting Program Feedback with the New Item Control

Timer Control

Object Declaration
Properties
Event
Methods

Setting Properties for the Timer Control
Providing Dynamic Feedback in Your Web Page with the Timer Control
Other ActiveX Controls
Summary
Q&A
Workshop
Quiz


Day
12  Advanced Objects: ActiveX, Java,

and ActiveVRML


Working with Objects
The ActiveX Chart Control
Integrating Java Applets
The ActiveVRML Viewer Object
Component Downloading Issues
Summary
Q&A
Workshop
Quiz


Day
13  VBScript Standards and Conventions


Advantages of Standards and Conventions

Code Maintenance Advantage
Improved Team Communication
Easier Debugging
Faster, More Effective Code Implementation
The Dangers of Not Using Standards

Standards to Use

Worldwide Standards?
Adopting Standards That Are Right for You and Your Company

Variables

Descriptive Variable Names
Mixed-Case Variable Names
Variable Name Prefix
Scope Prefix
Comments
Constants

Objects

Procedure Declarations
Descriptive Names for Procedures
Prefixes for Procedures
Procedure Comments
Good Procedure Conventions in Action

Within Your Code
Script Structure
Concerns

Myth: The Overhead Penalty Outweighs the Advantages of Standards
Myth: Standards Slow Me Down
The Non-Myth: Standards Constrain Me!

Summary
Q&A
Workshop
Quiz


Day
14  Working with Documents and User
Interface Functions

Giving the User the Message Through Message Boxes

Line Separation
Buttons and Titles

Input Boxes
Documents

The document Object and the form Object
The document.write Method
The HTML Body ONLOAD Event Procedure and Restrictions on Using document.write
Using document.write from VBScript at Page Load Time
Why Should You Use document.write?

Summary
Q&A
Workshop
Quiz



WEEK 2  In
Review

WEEK 3  At
a Glance


Day
15  Extending Your Web Pages with
Strings

Asc and Chr

Miscellaneous Functions: Ucase, Lcase, LTrim, RTrim, Trim, Left, and Right
InStr

Len and Mid

Space and String
Even More String Functions: IsEmpty, Cstr, Val, Hex, Oct, and StrComp

Summary
Q&A
Workshop
Quiz


Day
16  Extending Your Web Pages with
Dates and Advanced Math


Dates

Working with Dates and Times
Date, Time, and Now
Year, Month, Day, Weekday, Hour, Minute, and Second
DateSerial and TimeSerial
Date and Time Comparisons and DateValue/TimeValue
Understanding Date and Time Formats
CDate and IsDate

Math

What Does VBScript Let You Do with Math?
Abs and Sgn
The Logarithmic Functions-Log and Exp
The Square Root Function-Sqr
The Trig Functions-Sin, Cos, Tan, and Atn
Extending the Power of VBScript Through the Log and Trig Functions
Rounding and the Integer Functions-Fix and Int
Randomize and Rnd
Working with Non-Decimal Systems-Hex and Oct
The Mod Operator
Variable Representation of Numeric Data

Summary
Q&A
Workshop
Quiz


Day
17  Exterminating Bugs from Your
Script

VBScript Error Handling Support (or Lack Thereof!)

Syntax Errors: Say What You Mean!
Semantic Errors: Mean What You Say!

Effective Error Hunting

The Brute Force MsgBox Approach
Soothing the Wounds with the On Error Statement
If You Object to Errors, Use the err Object!
More on Error Handling with err and on error

Tracing Your Code

Traditional Debug Environments Versus VBScript


Visual Basic 4.0 Trace Capabilities
Secret Strategy for Visual Basic Programmers Who Are Debugging VBScript Code


HTML Trace Capabilities
VBScript Trace Capabilities

The Message Box Trace Approach
More Tools to Make Debugging Easier
The Message Box Saturation Trace Approach
The Message Box Variable Watch Approach
Breaking Apart Complex Statements to Uncover the Slimy Bug!

Ensuring That the Bug Is Dead

The Do-It-Yourself Trace Debug Window Approach

Building Your Own Trace Routines

Sample Variant Variable Analysis Routine

Error Handling to Include in Your Final Script
More Reasons Why VBScript Can Be Tough to Debug
The Moral of the Story
Summary
Q&A
Workshop
Quiz


Day
18  Advanced User Interface and
Browser Object Techniques


2-D Forms, the Layout Control, and the ActiveX Control Pad
Loading Graphics in Advance with the ActiveX preload Control

Caching Considerations When Using preload
Putting preload to Work in Your Script
Maintenance Considerations When Using preload

Anchor Clicks on Images and Text

The Anchor ID
The Anchor MouseMove Event
The Anchor Click Event
Redirecting a Link to Another Location
Directly Linking to Another Location

Browser Objects
Summary
Q&A
Workshop
Quiz


Day
19  Dynamic Page Flow and Server
Submittal


The Advantage of Validating Server-Bound Data
Reducing Traffic by Scripting Dynamic Pages
Summary
Q&A
Workshop
Quiz


Day
20  Porting Between Visual Basic
and VBScript

How Do Visual Basic and VBScript Compare?
Finding Differences When You Port Code
Syntax Elements in Visual Basic 4.0 but Not in VBScript

Constants
File I/O
Database Support/Data Access Objects
Classes and Property let/get/set Procedures
Financial Functions
String Functions
Variable Types
Intrinsic Objects-Print, Clipboard, and Debug
Error Handling, Gotos, and Labels
Program Control
Other Syntax Not Supported

Other Visual Basic and VBScript Differences

Arrays
Intrinsic Browser Objects
Multiple Form Architecture

Summary
Q&A
Workshop
Quiz


Day
21  Security, Stability, and Distributed
Source Control Issues


Stability Issues

Guarding Against Catastrophic Error Scripts

Security Issues

Guarding Against Malicious Scripts
Safe Components
Distributed Source Control

Summary
Q&A
Workshop
Quiz


WEEK 3  In Review

Appendix
A  VBScript Syntax Quick Reference



Appendix
B  Information Resources



Update Information for This Book

Sams.net Home Page
DoubleBlaze Software Consortium Home Page

The Internet Services Provider
General Information Resources

Carl & Gary's Visual Basic Home Page
CGI Specification
Lynx
Macmillan Computer Publishing
Microsoft
Microsoft ActiveX Control Kit
Microsoft Internet Download Toolbox
Microsoft Internet Explorer
Microsoft VBScript Information
Microsoft VBScript Language Reference
ncSA Mosaic
Netscape
Unofficial VBScript Information Page
Visual Basic CGI Programming
VBScript Observations and Samples
World Wide Web Consortium (W3C) Drafts
W3C Objects: "Inserting Objects into HTML" Working Draft



Appendix
C  Answers to Quiz Questions



Day 1
Day 2
Day 3
Day 4
Day 5
Day 6
Day 7
Day 8
Day 9
Day 10
Day 11
Day 12
Day 13
Day 14
Day 15
Day 16
Day 17
Day 18
Day 19
Day 20
Day 21





Credits






From Keith to Sue, and from Tim to Michelle.






Copyright © 1996 by Sams.net Publishing
FIRST EDITION

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. Although
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 Sams.net Publishing, 201 W. 103rd St., Indianapolis, IN
46290.


International Standard Book Number: 1-57521-120-3






HTML conversion by :
    M/s. LeafWriters (India) Pvt. Ltd.
    Website : http://leaf.stpn.soft.net

    e-mail :
leafwriters@leaf.stpn.soft.net





Interpretation of the printing code: The rightmost double-digit
number is the year of the book's printing; the rightmost single-digit,
the number of the book's printing. For example, a printing code
of 96-1 shows that the first printing of the book occurred in
1996.

Trademarks

All terms mentioned in this book that are known to be trademarks
or service marks have been appropriately capitalized. Sams.net
Publishing cannot attest to the accuracy of this information.
Use of a term in this book should not be regarded as affecting
the validity of any trademark or service mark. Microsoft and Visual
Basic are registered trademarks of Microsoft Corporation.






President, Sams PublishingRichard K. Swadley

Acquisitions ManagerGreg S. Wiegand

Managing EditorCindy Morrow

Marketing ManagerJohn Pierce

Assistant Marketing ManagerKristina Perry








Acquisitions EditorChristopher Denny
Development EditorAnthony Amico

Software Development Specialist
Steve StraigerProduction Editors
Kitty Wilson Kris Simmons
Copy EditorsKate Shoup, Colleen A. Williams
Technical ReviewerGreg Guntle

Editorial CoordinatorBill Whitmer
Technical Edit CoordinatorLynette Quinn

Editorial AssistantsCarol Ackerman, Andi Richter, Rhonda Tinch-Mize
Cover DesignerTim Amrhein

Book DesignerGary Adair
Copy WriterPeter Fuller

Production Team SupervisorBrad Chinn

ProductionMary Ann Abramson,Georgiana Briggs, Cheryl Dietsch, Michael Dietsch, Chris Livengood, Paula Lowell, Mike Henry, Dana Rhodes, Andy Stone







Foreword

A popular saying in the Internet development arena nowadays states
that if a technology is more than three months old, it's obsolete!
This sentiment is perhaps exaggerated for effect, but it does
underscore a very significant change the industry is undergoing.
New software technologies and breakthroughs are coming at a breakneck,
leapfrog pace. Staying current is more of a challenge than ever
before. Picking the technologies that will be here to stay, as
opposed to pretenders to the throne, has never been tougher.

If you have a copy of this book, though, we think you've picked
a winner. VBScript opens up a world of possibilities for the environments
you apply it to-Web pages in particular. You can create smart,
active, and interactive Web pages with VBScript with unparalleled
ease. It is difficult to appreciate the full power and impact
of this new scripting language without a good resource to back
it up. It's been our aim to get such a resource into your hands
as soon as possible. The "under-construction dust" is
just settling as this book goes to print, but already it is clear
that a capable, stable, mature product has emerged.

Microsoft, like many companies in the opinionated Internet fray,
has its detractors. As a large, high-profile company and somewhat
of a late arrival onto the Internet scene, its technologies are
the focus of great anticipation and in some corners, even skepticism.
The skepticism has been unfounded. Microsoft has delivered a scripting
language that is easy to use, flexible, powerful, and secure.
The most prominent home of the original release of this language
is the browser, which is the main focus of this book. However,
you can certainly expect it to become integral to many more products
as the future unfolds. VBScript is a technology that is here to
stay. As the waves of technology change in the exciting months
and years ahead, it is a safe bet that VBScript will be riding
the tide. To some extent, the course of many other of the vessels
traveling the sea might be changed because of VBScript.

Keith and Tim
July 1996




Note


This book is based on a stable beta version of Internet Explorer 3.0 and Visual Basic, Scripting Edition (also called VBScript). We've expended a lot of effort to ensure that it is as accurate as possible. However, if any discrepancies between the material
covered here and the official product release of Internet Explorer 3.0 and VBScript come to light, they will be fully documented and available online. Refer to Appendix B, "Information Resources," for information on how to obtain the latest
updates, if any, from Macmillan Publishing's site

(http://www.mcp.com/).





Disclaimer from the Publisher

The information contained in this book is subject to the following
disclaimers:

The information in this book is based on a beta that is subject
to change.
Microsoft does not endorse the content of this book, nor will
it provide support for the beta product.
You can visit Microsoft's Web site at http://www.microsoft.com/vbscript
for up-to-date information about Visual Basic, Scripting Edition,
and http://www.microsoft.com/intdev
for related ActiveX information and software.



Acknowledgments

We would like to thank Sams.net for the opportunity to tackle
a topic that we view as a very important, exciting step in software
evolution. Along with this, we extend a special thanks to Chris
Denny for his help and support all along the way; Tony Amico,
our key development editor; Kitty Wilson, our ever-patient production
editor; Greg Guntle, technical editor; and the rest of the great
Sams team behind us. Appreciation is similarly extended to the
great gang at CNS, our Internet service provider and the best
"voice of experience" we've found on rapidly evolving
Internet connectivity issues.

We'd also like to thank our colleagues at X-Rite, Incorporated,
where we develop software by day. Although this book is a project
independent of the company, we certainly benefit in knowledge
and spirit from our daily association with such a fine group of
co-workers. Thanks especially to Steve Peterson for encouraging
a view toward the leading edge of technology.

Thanks also to our friends and families. Without them, the book
couldn't have come about. After spending much time on the last
book saying, "It's gonna be a long time before we do this
again," something unexpected happened. A fantastic topic
coaxed us out of retirement and made liars of us within just a
few months, and there we were, doing it again. This book came
during busy times in our lives. During the time the book was written,
we dealt with sick cockatiels (Tim), rescuing kids locked in the
bathroom and taking them to the circus (Keith), wedding preparations
(Tim), the Boston Marathon (Keith), busy work schedules (Tim and
Keith), and then the wedding itself (Tim and Michelle)! We strove
very hard for quality in this book and felt we never sacrificed
in this regard. We did sacrifice time with family and friends,
who nevertheless were right there behind us every step of the
way. So much credit goes to them all.

Much thanks and love from Keith to Sue and from Tim to Michelle.
This book is dedicated to them.

Keith adds: Thanks to my wife, Sue, for assisting with so many
aspects of the book preparations in addition to being there every
step of the way. Thanks also to Ginger, Mom, and Dad, not only
for the support in general, but also for making the kids the world's
happiest grandkids. To Ginny, Emma, and Ben, who are still waiting
on that pool to go up, to family and friends who are wondering
when my hair will stop looking so ruffled, and to special running
comrades who are waiting for me to stop complaining that I'm out
of shape: Thanks for understanding. Another book has been borne
into the world, and we think it's an important one.

Tim adds: Thanks also to my wife, Michelle, for being so understanding
and supportive during the busy time of wedding preparations and
beginning a new life together. She has been patient and tolerant
of those evenings when I had to spend an inordinate amount of
time in the den at my computer and when my schedule got a bit
hectic. She has been a terrific partner, and I look forward to
a wonderful life together with her. Thanks also to our pet cockatiel,
Buddy Bird, who not only provided me with some great examples
in the book, but was a great companion on those lonely days when
Michelle was at work. We also thank our parents for their support
all through the years, both past and present.

About the Authors

Keith Brophy

Keith Brophy has many years of experience in the design, development,
and testing of software systems. He is currently a software release
coordinator for X-Rite, Incorporated, a leading worldwide provider
of color and appearance quality control software and instrumentation
in Grandville, Michigan. Prior to that, he was a lead software
developer for IBM's System Integration and Federal Systems divisions
in the Washington, D.C., area and worked on a wide variety of
systems. His experience includes building Internet systems in
the "pre-Web" era. During this time, he also was responsible
for various operating system, performance, and graphical user
interface research and development projects. He has taught in
various venues, including Northern Virginia Community College
and as the advanced Visual Basic adjunct faculty member at Grand
Rapids Community College.

Mr. Brophy, along with Mr. Koets, co-authored Visual Basic
4 Performance Tuning and Optimization (Sams 1996) and was
a contributing author for Visual Basic 4.0 Unleashed (Sams
1995). He also served as technical editor on Real-World Programming
with Visual Basic (Sams 1995) and the revised edition of Teach
Yourself Visual Basic 4 in 21 Days (Sams 1995). He has a B.S.
in computer science from the University of Michigan in Ann Arbor
and an M.S. in information systems from Strayer College in Washington,
D.C. Mr. Brophy is the founder of DoubleBlaze Software Consortium
(http://www.doubleblaze.com), an
ActiveX Internet research and development company involved in
endeavors such as research for this book.

Timothy Koets

Timothy Koets is a software engineer at X-Rite, Incorporated,
a leading worldwide provider of color and appearance quality control
software and instrumentation in Grandville, Michigan. Prior to
this, Mr. Koets was a computer systems engineer in the Systems
Engineering and Integration division of Martin Marietta in the
Washington, D.C., area. In addition to developing Visual Basic
applications, Mr. Koets has experience in many other areas including
Visual C++, computer networking, client/server application design,
parallel processing, and performance analysis. He, too, has previous
experience building pre-Web systems that were Internet aware.
Mr. Koets is an adjunct faculty member at Grand Rapids Community
College, where he teaches advanced Visual Basic, and has prior
teaching experience ranging from computer programming and engineering
laboratory classes to Lotus Notes training courses.

Mr. Koets, along with Mr. Brophy, co-authored Visual Basic
4 Performance Tuning and Optimization (Sams 1996) and was
a contributing author for Visual Basic 4.0 Unleashed
(Sams 1995). He has a B.S. in electrical engineering
and an M.S. in electrical engineering from Michigan Technological
University in Houghton, Michigan. Mr. Koets is the founder of
Cockatiel Software, an Internet research and development company
that is an affiliate of DoubleBlaze Software Consortium (www.doubleblaze.com).

Tell Us What You Think!

As a reader, you are the most important critic of and commentator
on our books. We value your opinion and want to know what we're
doing right, what we could do better, what areas you'd like to
see us publish in, and any other words of wisdom you're willing
to pass our way. You can help us make strong books that meet your
needs and give you the computer guidance you require.

Do you have access to CompuServe or the World Wide Web? Then check
out our CompuServe forum by typing GO
SAMS at any prompt. If you prefer the World
Wide Web, check out our site at http://www.mcp.com.




Note


If you have a technical question about this book, call the technical support line at 800-571-5840, ext. 3668.





As the team leader of the group that created this book, I welcome
your comments. You can fax, e-mail, or write me directly to let
me know what you did or didn't like about this book-as well as
what we can do to make our books stronger. Here's the information:


Fax:317-581-4669
E-mail:programming_mgr@sams.mcp.com


Mail:Greg Wiegand

Comments Department
Sams Publishing
201 W. 103rd Street
Indianapolis, IN 46290





Introduction

How important is VBScript to the future of computing? How important
is it to you? Does it give you new capabilities that you can't
get in other languages, or is it just another choice in a sea
laden with confusing buzzwords? If you've pondered questions like
these, you're not alone. VBScript is one of the most exciting
new players in the rapidly expanding universe of technologies
loosely termed the Internet. The purpose of this book is
to teach you how to use VBScript. As a brief prerequisite to that
journey, consider why VBScript is such an important part of the
Web page development arsenal. Perhaps the best way to understand
the potential of this future-centered technology is to take a
look at how far the Internet has come. You might find that you
have been involved in many of the trends leading up to the advent
of VBScript without even realizing it, just as the authors have
been.

A little over a decade ago, one of the authors was producing Department
of Defense software and the reams of documentation that go along
with it. One of the requirements in putting together this documentation
stipulated that it should be generated in a markup language called
SGML. This markup language was quite cumbersome. For example,
it required that each heading start with an h1
tag and each paragraph with a p
tag. Eventually, this project came to an end, and it seemed that
this memory was just a relic of the past. Then, along came the
World Wide Web. Behold: The World Wide Web is based on a page
description language inherited to a large extent from SGML! The
tag-oriented approach for Web pages succeeded precisely because
it leaves the work of presenting Web pages to the browser. This
approach provides an efficient, low-overhead means for communicating
across the Internet because it enables the information sent across
the network to be content-centered while the browser takes care
of the cosmetic details on its own.

About a decade ago, another important change in the computer industry
began. The mainframe-centered computing world, where all work
was performed on a central computer, was quickly being replaced
by a more distributed model. Users could now do some of the work
locally, using the horsepower of their own pcs rather than the
mainframe. For example, an accountant could now do much of her
work in a spreadsheet on her own pc, rather than vie for time
on an overloaded mainframe to perform accounting analyses.

Once users had more computing power in front of them, they could
take advantage of that power with a graphical user environment.
Windows filled this need, but the next big problem was creating
the Windows applications themselves. In the early days when C
was the only viable language alternative, Windows program development
required such degrees of experience and development time that
Windows programming was out of the reach of many. It was also
quite difficult to integrate other commercial components into
applications. Visual Basic came forward to fill these voids. Because
of its ease of use and component integration capability, Visual
Basic achieved widespread acceptance over the course of the next
few years and releases. Some even claim that this language, which
did not exist a decade ago, is now the world's most popular programming
language.

That brings us to the very recent past. The Web provides a way
to deliver content across the Internet to client computers, often
pcs, using the tag-oriented HTML language. A page is sent from
some host computer for an end user to look at. The browser on
the end user's computer has the job of presenting the information.
What if more complex processing is needed in conjunction with
a page? Suppose you want to trigger a series of simple financial
calculations from a Web page. The HTML language doesn't provide
such support. For a while, the only way to do this was to use
an approach similar to the old mainframe approach-send requests
back to the host computer and make it perform the processing.
Then came the advent of JavaScript. With JavaScript, when the
browser on a client computer presents the page to the user, it
can also act on the embedded JavaScript instructions to perform
smart processing. However, it takes experience to develop JavaScript
programs, which are somewhat like C++ in nature. If you are a
new programmer or one of the million or more programmers whose
background is Visual Basic, you'd require a certain amount of
effort to get up to speed on the JavaScript language.

Development for this very exciting environment required a language
that not all could easily master. Sound like a familiar problem
to you? It did to Microsoft, too, and in the process of inventing
a comprehensive Internet strategy, Microsoft reinvented, or at
least reengineered, the wheel. Visual Basic, Scripting Edition
was its answer to these problems. VBScript, a subset of its parent,
Visual Basic, is an easy-to-use language that is a cinch to integrate
and provides an easy path to incorporate components.

If this brief history of the Internet and the reasons why VBScript
came about are new to you, don't worry-you can take comfort in
the fact that the currents of change are flowing in the right
direction to make your Web page development easier than ever before.
As to the "how" of VBScript, we'll tell you everything
you need to know about using VBScript in the pages ahead.

Step-by-step, we will teach you how to use Visual Basic, Scripting
Edition to its fullest potential. You will also see how to take
advantage of powerful intrinsic controls, ActiveX controls, Java
applets, and other objects through VBScript. During this journey,
we will cut through all the Internet jargon and buzzwords, helping
you to clearly understand how all the pieces of the Internet fit
together and how you can participate in this new way of sharing
information. We won't bore you with all kinds of information on
the Internet that you don't need, nor will we give you just a
cookbook of techniques. Rather, this book will give you the ability
to creatively and expressively use VBScript to write impressive,
powerful, useful Web pages.
Who Should Read This Book

This book is for you if you find yourself in one of the following
categories:

You've seen what's on the Web, and you want to contribute
your own content.
You represent a company that wants to make its presence known
on the Internet in a powerful and productive way.
You're an information developer, and you want to learn how
the Web can help you present your information online.
You're a Visual Basic programmer who wants to create Web pages
on the Internet without learning yet another programming language.
You've used HTML to create Web pages, but you find it too
limiting.
You've mastered HTML and CGI and want to move beyond the limited
capabilities of static Web pages. You want to use VBScript to
bind programs around your pages, making your Web pages more dynamic.
You've used other scripting languages, such as JavaScript,
and you're interested in using a simpler language to accomplish
your goals.

What This Book Contains

This book is intended to be completed in 21 days-one chapter per
day-although the pace is really up to you. We have designed the
book as a teacher would teach a course. We start with the basics
and continue to introduce more of the language to you as the chapters
progress. By the end of the first week, you will be creating your
first VBScript Web page. As you work through the chapters, you
will continue to design Web pages using VBScript that will become
increasingly more powerful. In the second and third weeks, you
will be exploring the more advanced features VBScript provides.
In addition to instruction, we will furnish an abundance of examples,
as well as exercises for you to try. You can learn a great deal
by reading, but only when you try building a few VBScript Web
pages of your own can you become truly experienced.

During Week 1, you get a general overview of the Internet,
the World Wide Web, Web browsers, and the languages available
to develop Web pages. You will learn how to create variables,
how to use operators to put variables to use, and the overall
syntax of VBScript. Finally, you'll see a Web page incorporating
useful VBScript code that will bring the Web page to life!
During Week 2, you will be introduced to ActiveX controls.
ActiveX controls enable you to present your Web page to the user
in a very powerful way. You will also learn about intrinsic controls
and objects. Then you will learn how to control the user interface,
process and interpret user input, work with mathematical functions,
and extend VBScript capabilities in various ways.
During Week 3, you will learn about even more powerful capabilities
of VBScript. You will learn more about handling dates, strings,
and mathematical functions. You will be exposed to advanced concepts
about ActiveX control objects and intrinsic browser objects. You'll
learn about script-based strategies to generate data on the client,
validate it, and then provide it to the server for storage. You'll
also learn key debugging and porting skills. At the completion
of this week's material, you will have the well-rounded background
needed to tackle all aspects of VBScript development.


With this book, you will become comfortable enough with VBScript
to design and implement powerful Web pages of your own and become
confident in your abilities to use it effectively-all in three
weeks or less!
What You Need Before You Start

Because this is a book about creating Web pages, we assume that
you are already able to access and use the Internet. You should
have a World Wide Web browser that supports VBScript, such as
Microsoft's Internet Explorer 3.0, and you should be somewhat
familiar with it. (Steps to obtain such a browser are provided
on Day 1.) A basic knowledge of the other Internet services such
as electronic mail, FTP, Telnet, Usenet news, and Gopher is not
necessary for working through this book, but it may be helpful
for your future page development, particularly if you want your
Web pages to interact with these services. As is true whenever
you learn a new programming language, the more experience you
have with programming, the better. Don't worry, though, if programming
is new to you; you should be able to write VBScript code with
a minimal amount of previous programming experience. Our objective
is to begin from the ground up, and we do not assume you are an
expert programmer. After all, VBScript is not designed just for
experts, but for anyone interested in building active Web pages
quickly-you don't necessarily have to be a computer language guru.

You're now ready to begin the first chapter on your journey of
learning how to use VBScript. We're excited about showing you
the potential of this new, exciting language. The journey will
be well worth the effort.










Wyszukiwarka

Podobne podstrony:
index
index
index
index
index
index
index
492 496
index

więcej podobnych podstron