Remember the thrill of visiting your first Web page and clicking your first hyperlink to another site? The excitement of surfing from California to Maine, from Australia to Finland? This interactive nature of the Web attracts millions of people to the Web every day.
In building Web pages, you present information to your audience. The design and layout should entice them to explore your site. Your hyperlinks provide several predefined, but different, paths to see your information.
The source code in listing 1.1 is easy to modify to tell your own jokes on the Web without giving away the punchline.
There are too many colors for a user to choose. Don't make them experiment; let them select from some good combinations you have already tested.
An example is HTML Analysis (see fig. 1.8). In the control panel at the bottom of the window, you specify a URL that is displayed in the left frame. The right panel is generated from the code activated by the REDO button. This code reads the HTML code of the left document and creates an entirely new document that lists all of the hyperlinks. This new document is displayed in the right frame.
Figure 1.8 : The URL specified in the top frame is displayed
in the second frame. The third frame shows only the links from
that page. Such tools are a great way to make certain pages on
your site meet your standards.
Listing 1.2 shows the frames for HTML Analysis.
Listing 1.2 hanalysi.htm Frames for HTML
<HTML> <HEAD> <TITLE>HTML Analysis by Ray Daly</TITLE></HEAD> <FRAMESET ROWS="80,300,*"> <FRAME SRC="hanalys1.htm" NAME="control"> <FRAME SRC="" NAME="displayhere"> <FRAME SRC="" NAME="analysis"> <FRAME SRC="guide.htm" NAME="guide"> </FRAMESET> </HTML>
Listing 1.3 shows the code for HTML Analysis.
Listing 1.3 hanalys1.htm Code for HTML
The HTML Analysis application is not stable on all platforms. Make sure the URL is completely loaded prior to doing the analysis.
You can reformat pages for dramatic results. Instead of showing the entire document in a large frame, bring the source document into an extremely small frame. Then display your reformatted document in the much larger frame. If the frame with your source is small enough, your users won't even know what the original looked like.
For more information on plug-ins, visit this site: http://home.netscape.com/comprod/products/navigator/version_2.0/plugins/.
Microsoft is actively promoting its scripting language VBScript. The primary function of this language is to interact with and create external applications. Because this language is a subset of Microsoft's Visual Basic and works with ActiveX controls, it is expected to have a substantial impact.
There is no definitive definition of a scripting language. Sometimes the term is used to make a distinction from compiled languages. However, some languages like C or C++ can be used for scripting as well as full applications. The term scripting is also used because a language will react to, control, or "script" a series of events. Even macro languages built into PC applications like spreadsheets, databases, word processors, and multimedia applications are now often called scripting languages.
Traditionally, a macro feature was added to PC software to allow a simple series of commands to be executed with a single keystroke. With great fanfare publishers introduced this feature as a way to reduce repetitive tasks and save time. For example, a word processor's simple macro might change the entire style of a document.
Over time the macro feature of various applications became complex scripting languages. As scripts became longer and nontrivial, they extended the software beyond its normal purpose. New and creative combinations of commands made the software the basis for entirely new applications-for example, a set of word processing scripts for maintaining a small mailing list.
These scripting languages in software are so sophisticated that they are the subject of college courses. Many universities now require courses in spreadsheet scripting for accounting and business students. Art majors are learning scripting procedures for high-end graphics and multimedia packages. Legal courses include using scripts to create documents. And computer science majors have a variety of courses involving scripting languages.
A defining factor of this type of scripting language is that they only work with applications. Scripts in word processors add word processing features. Scripts in spreadsheets add spreadsheet features. These scripts do not go beyond the nature of the software, but they use the existing commands of the software. In our example, the mailing list script still works with words, the standard element of the word processor. This becomes a limitation on the usefulness of this script.
With the popularity of program suites like Microsoft Office, Lotus SmartSuites, and Perfect Office, PC publishers have started making the same scripting language work with more than one application. (Some would say that, at this point, macro languages become scripting languages.) Not only is the same language used in each application, the script language helps the applications work together. Microsoft expanded the role of Visual Basic to work with Microsoft Access and Excel. Lotus has developed LiveBasic for its product suite.
With the PC environment, the role of scripting languages is serious
business. It's the subject of college courses and often used to
build nontrivial applications.
Historically, scripting has made several "killer applications." These are applications, that define a whole new category of software, significantly expand the market, and provide a primary reason for people to use a computer. The first successful spreadsheet was VisiCalc, which disappeared with the success of Lotus 1-2-3. The latter had scripting. There were many different database applications on the market before Ashton-Tate's dBase, but this product was programmable with a scripting language.
Scripting gave these applications a competitive edge. First, it was a feature that could be used to sell the product. Second, people actually started to use the feature and create significant new capabilities for these products. Third, these scripts created a whole new market with magazine articles, books, third-party software publishers, and training. Fourth, the continuing use of these scripts became an investment by the user in these products. Existing scripts often prevented users from switching to competitive products. And finally, even when a competitive product was introduced with new features, someone would introduce scripts that attempted to add these features into the existing products. Scripts allowed both the publisher and users to advance.
The most notable use of scripting on the Macintosh is Apple's HyperCard program. This application lets you build a group of cards and hyperlink them together. The cards can contain not only text but multimedia files. The stack of cards that you construct can respond to user input.
If you have used the Web, you have used Perl. It is the language used for probably the majority of CGI scripts. These are routines that run on Internet servers and respond to requests from browsers when a user completes a form. There are guestbooks, message boards, voting pages, surveys, and more that use Perl scripts.
Perl is an interpreted language. While you should be able to find a version of Perl for almost any computer platform, it was created for UNIX systems. It is now platform independent. The vast majority of Perl scripts will run without modification on any system. Take a script written on UNIX and it will run perfectly well on DOS.
A CGI script is a type of script that responds to events. In this case, the event is a user submitting data from an HTML form. The attributes of a <FORM> include ACTION, which defines the script to process the data when it is submitted. For example,
will process the data from the form in a script called guestbook.pl. More than likely this routine would store the data in a file and return an HTML page to the browser as feedback. It would probably say something like, "Thanks for your entry into our guestbook."
Perl is freely distributed on the Internet, but please see its license for more detail. You should be able to find a version for your system using any of the Internet search services. Larry Wall is the sole maintainer.
Perl's strength as a language is in manipulating files and text to produce reports. This capability along with its associative arrays make it a natural fit for creating CGI scripts. In a few lines you can process data and return an HTML document in response to an HTML form.
With the standard Web site, you get more information by clicking a hypertext link and having the server send you another file. On a more interactive page, you complete a form, submit the results to the server, and wait for a response. In either case you must wait on the server to send a new file. This information is almost always a new page, though it might be a multimedia file like an audio clip or an animation.
Consider the following example:
/* This is the start of multiple lines of comments.
This is the end */
To make a comment at the end of a line or on a single line, just use the characters // and everything after that mark until the end of the line will be considered a comment.
Between SCRIPT tags you can write two types of code: direct statements and functions. Direct statements are executed by the browser as they are loaded. For example, objects are initialized in direct statements. Functions are blocks of code that are executed only by other code or events.
For example, mouse-click events usually trigger functions. Most of your programs will use both direct statements and functions.
<FORM> <P>Click inside the box and then out to see change. <INPUT TYPE="text" NAME="sample" onChange = "sample.value = a"> <!-- ...after any change in this text box, but the value of a in the box --> </FORM>
But this is a limitation. There are not any new operations that
give you multimedia capability like sound or graphics. To add
these types of features, you need to extend the capability of
the browser with plug-ins, Java applets, or other external applications.
These programs may or may not make their objects available to
This feature is not supported in version 2.0, but is planned for version 2.1 of Netscape Navigator.
|Interpreted by client||Compiled by the author, run on client|
|Code integrated in HTML documents||Applets distinct from HTML document|
|Loose typing of data types||Strong typing of data types|
|Dynamic binding||Static binding|
|Script limited to browser functions||Stand-alone applications|
|Works with HTML elements||Goes beyond HTML (for example, multimedia)|
|Access browser objects and functionality||No access to browser functionality objects or|
Sun and Netscape have mounted a high profile campaign to ensure the security of these products. Neither product writes to the user's hard drive. Sensitive information about the user is also unavailable to these languages. So both products are limited by security and privacy concerns of their environment.
Java Displays Are Limited to a Graphic Area To display information on a Web page, Java is limited to painting its text and graphics within a defined area. Just like images on a page are drawn within a defined area of the page, so it is with Java programs. Within these areas the Java applets can create animations, paint, and use various fonts. However, an applet cannot affect anything outside its area.
properties of the page or any element of the page. You can create
lets you change the appearance of any part of your Web documents,
not just a limited area.
The hype on Java is that it is flexible enough to do anything. Currently, it cannot affect anything in a Web page outside of the area to which it is assigned. If you want your HTML document to interact with Java, forget it. The only way for Java to control everything on the screen is to write a program from scratch and re-create the entire screen. You basically have to rewrite some browser functions.
Directly related to this is Sun's work on a new version of HotJava, its Web browser. Apparently the new version's primary goal is to make available general-purpose browser routines for Java programmers. It is not clear at this time how this will play out, but the development of HotJava is worth watching.
Java Applications Can Stand Alone Java is a general-purpose language that can create stand-alone applications. Unlike the Java applets that run in Web pages, these applications may not even connect to the Internet but perform business functions like accounting. This is an important aspect of Java that has excited many people.
an application. Currently it works with Netscape's Navigator browser
and the LiveWire server environment. In the near future it will
Java is a Compiled Language With Java you write your code, compile it, and then run it. The person using your Java applet from a Web page cannot look at the source code. For many programmers, there is a sense of security here that you are not giving away your code.
Java is very much like the C++ language. It is object oriented, uses many of the same statements, uses libraries, and is compiled. Several companies that have strong C++ programming environments are developing similar environments for Java. This will allow the development of large-scale Java applications, but you will have to learn these programming environments.