![]() |
![]() |
![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
![]() |
![]() |
To access the contents, click the chapter and section titles.
Perl CGl Programming: No experience required.
Using the Netscape ExtensionsThe most important and interesting of the Netscape extensions are the elements that deal with frames and applets, which is a word coined to describe little programs. The other extensions can be useful, but they dont do nearly as much as frames and applets do. In fact, the BLINK element can be misused so easily that youre probably better off not using it at all. Problems arise if you forget to end the blinking block with </BLINK>your visitors will be horrified to find your entire Web page flashing merrily at them. HTML frames have become so common on the World Wide Web that Webmasters must be assuming their visitors are using browsers that can handle them. Frames provide an interesting tool for Web development because they allow versatility in a page that plain-vanilla HTML simply isnt able to. Plus, as you learned in Skill 5, because the documents comprising the framed Web page are specified with URLs, you can automatically launch a CGI application from the frame command. If you are unfamiliar with how frames are constructed, a short example will make things clearer for you. It will take three HTML files, as follows: <HTML> <HEAD> <TITLE>Testing HTML frames</TITLE> </HEAD> <FRAMESET COLS="20%, 80%"> <FRAME NAME="left" SCROLLING="NO" SRC="leftside.html"> <FRAME NAME="right" SRC="rightside.html"> </FRAMESET> </HTML> Save this one as frame.html, then enter the next one: <HTML> <HEAD> <TITLE>Left side frame</TITLE> </HEAD> <BODY> <H2 ALIGN="CENTER">This is the left side frame</H2> </BODY> </HTML> Call this file leftside.html. The next one looks like this: <HTML> <HEAD> <TITLE>Right side frame</TITLE> <BODY> <H2 ALIGN="CENTER">This is the right side frame</H2> </BODY> </HTML> Save this file as rightside.html. Make sure all three files are in the same directory, or install them in your Web servers default document directory. You can open frame.html directly from your browser or invoke it as a URL; in any event, frame.html is where the action starts. You should see something similar to the illustration in Figure 10.4.
Examining the Frame StructureFrames are useful if you want to keep a static index or some other unmoveable information on part of a Web page, where the other parts can scroll and grow as they need to. In the frame example weve just put together, the left side will not scroll, while the right side will. The key to running a framed page is the main fileframe.html in the examplewhich, through the <FRAMESET> declaration, calls in the left- and right-side pages. Notice the declaration: <FRAMESET COLS="20%, 80%"> <FRAME NAME="left" SCROLLING="NO" SRC="leftside.html"> <FRAME NAME="right" SRC="rightside.html"> </FRAMESET> The <FRAMESET> element in this example calls for two columns, the first taking up 20 percent of the screen and the second taking up the remaining 80 percent. The two windows could have been made into rows by using the ROWS= tag instead. Next, the frames themselves are defined with the <FRAME> tag. The NAME tag allows you to write HTML code that puts documents in the named window. The file names of the HTML documents that draw the left and right windows are specified in the SRC tags and thats how the windows are displayed. A final thing to remember about setting up frames is that the FRAMESET element stands by itself in the document. If you accidentally enclose it in a BODY element, which is quite possible if you use software that automatically generates HTML, your frames wont show up. Using Netscape AppletsThe APPLET element includes an inline program in your HTML page and runs it. It is only capable of running Java applets at present, but Netscape and other developers would like the APPLET element to be able to run any program, subject to security considerations, of course.
Running a Java applet from the Web page is fairly straightforward. Heres a snippet of HTML code that calls an applet: <APPLET CODE="AJavaClass.class" WIDTH=450 HEIGHT=500> <PARAM NAME="stuff" VALUE=450> <PARAM NAME="nonsense" VALUE="Stuff and nonsense"> </APPLET> This code loads the Java file AJavaClass.class into the browsers Java interpreter, opens a 450- by 500-pixel window in the browsers main window and runs the applet in it, passing parameters named stuff and nonsense to the Java program, which will do with them as it sees fit.
Moving On You digressed a bit from Perl and CGI in this skill to learn about how the language of the World Wide Web was created, and about some of the enhancements that have been made to HTML over the years. In Skill 11, youll learn about the platforms of the World Wide Web, the computers and operating systems that can be used to build a Web site. Youll cover the three most popular operating systemsUNIX, Windows NT, and Windows 95in a bit more detail. Are You Experienced?Now you can
|
![]() |
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc. All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. |