What
Are Scripts?
Scripts are like little computer programs that run right in a web page.
Scripts are generally used to add interest and functionality to the
page. Simple search engines, advertising banner rotators, calculators,
graphics animations, bulletin boards, chat windows, shopping carts and
games are just some examples of web page elements that can be built
using scripts.
Scripts
are unlike programs in that they are typically much simpler than a full-featured
program. For example, the Thinkydink Quote of the Day on the Thinkydink
Home Page is a script that selects and displays a line of text based
on certain rules established in the script. Compare that tiny bit of
work to the work done by a full-featured computer program like a spreadsheet
or word processor.
Scripts
are similar to programs though, and I think the biggest similarity is
that they are written in a programming language. HTML is a programming
language, but scripting languages are bit more complex. HTML code is
only intended to format and display text and graphics, but scripts can
have calculation and decision logic built into them. You don't have
to have a special program like C++ or Visual Basic installed on your
computer to write scripts---a simple text editor is often adequate---,
but you do need to have a thorough understanding of the scripting language
you wish to use.
The
most common scripting languages used in web development are Javascript,
CGI and Perl. VBScript used to be on this list, but it's been pretty
much replaced by Active Server Page (ASP) technology. ASP is a programming
language used to write full-featured web programs---it does everything
VBScript can do, and MUCH more.
Javascripts
run in the web pages themselves, while CGI and Perl are scripting languages
used to relay commands and information between web pages and the server.
With CGI and Perl, most of the script typically resides on the server
and a command to run the script is launched from the web page. Note
that when I say a script is run in the web page, this doesn't mean that
all of the script is necessarily written right into the page code like
html. Web developers can store their scripts in a separate directory
and only include references to them in the web page. This is a good
practice when a single script is used by multiple pages, or when the
developer wants to ensure web surfers can't view or copy his script.
Finally,
while most scripts are small and designed to perform only one or two
functions, it is possible to write scripts that behave more like full-featured
programs. This is often not a good idea, however, since the script's
performance is dependent on the speed of the user's connection and the
functionality of the user's browser. ASP, CGI scripts and Perl scripts
are better suited to workhorse page elements like shopping carts and
chat rooms because most of their calculations and manipulations take
place at the server, not in the browser window. A page can have a very
cool Javascript VBScript element built into it, but if the script is
slow the user won't stick around long enough to see what it does.
Back
to Top
Using
Other Developers' Scripts in Your Pages
So
you know what scripts are and having an inkling of what they can do,
but you have no idea how to write scripts of your own. Lucky for you,
there are lots of developers out there who have already written tons
of scripts and are willing to let you use them for free!
There
are lots of sites offering re-usable scripts. Try typing the search
string, "free javascript" or "free Perl script"
into any search engine and see how many hits you get. The best sites
have a lot of scripts to offer, and just as importantly, those scripts
are very well commented. Using a script you obtain from one of these
sites is as easy as copying the script, pasting it into your page and
modifying it as you wish per the included instructions in the script
comments. For more information about that process, as well as for details
on how you can use the scripts you find on the Thinkydink site, see
Steal This Code.
Back
to Top
Learning
to Write Your Own Scripts
As
I say on the Thinkydink Home Page, if you can
take a complete, classroom course in something, by all means do it.
This holds especially true of programming languages because they're
not simple or intuitive. But if you don't have the time or dough for
that, there are other options available.
There
are free tutorials all over the web. Type the search string, "learn
javascript", "learn Perl" or "learn CGI" into
any search engine and see what you get. The quality of the tutorials
varies, so you may have to hunt around to find something satisfactory.
A couple of sites I recommend are Webmonkey
and EchoEcho.
Another
tack to try is computer-based training (CBT). If you work for a huge
company, it's pretty likely there's some kind of CBT program available
to you at work for little or no cost. Some companies subscribe to online
CBT services and even though they may subscribe so their employees can
use the service for word processor or database user training, you can
typically access the whole libary of CBTs on the site.
Training
materials can also be found in your local book or software store, or
even your public library. There are lots of educational book, CD-ROM
and DVD titles available for programmer training. Some come in the form
of a kit with a book and CD-ROM packaged together. If you're borrowing
the materials from your library you can take a hit and miss approach
until you find training you're happy with, but if you're going to buy
the materials you should ask more experienced developers for recommendations
or carefully study the consumer ratings published on shopping sites
like Amazon before making your purchase.
Books for programmer training usually run around $40, and those that
have a CD-ROM included can be more like $70.
If
the training will help you in your job at all, also be sure to check
with your manager or HR department to see if you can request reimbursement
for money you spend on classroom or self-study training.
Back
to Top