A Complete Guide to Web Design

(やまだぃちぅ) #1
164 Chapter 9 – Adding Images and Other Page Elements

Adding Java Applets to the Page


Web Design in a Nutshell, eMatter Edition

To use this the way it was intended, thelowsrcimage should contain the same
image as the final graphic, but in a format that compresses to a much smaller file
size. For instance, an image made up of only black and white pixels could stand
in for a full-color JPEG.
Some web authors uselowsrcto simulate a two-frame animation effect, such as
having some element appear in the second pass that wasn’t in the initiallowsrc
version. Bear in mind that the effect only works the first time the page is down-
loaded, and depending on the way the images are cached, thelowsrcimage may
not show up again just by reloading the page. Also, on a very good connection,
thelowsrc image may flash so quickly that users may miss it entirely.

Adding Java Applets to the Page


Java applets are self-contained programs written in the Java programming
language, that can be placed inline on a web page just like a graphic. There are
lots of Java applets available on the Web for free from Java library sites such as the
JavaBoutique(http://javaboutique.internet.com).
Most Java applet instructions require that you add the applet to the page using the
handy<applet>tag (made just for the job!). However, the HTML 4.0 Spec recom-
mends that applets be added using the<object>tag instead, although this is
problematic in that some browsers don’t recognize the<object>tag when used
with Java. In this section, we will focus on the<applet> method.
The<applet>tag is a container for any number of parameter (<param>) tags.
The following is an example of how an<applet> tag for a game might look:
<APPLET CODEBASE=class CODE="Wacky.class" WIDTH=300 HEIGHT=400>
<PARAM NAME="Delay" VALUE="250">
<PARAM NAME="Time" VALUE="120">
<PARAM NAME="PlaySounds" VALUE="YES">
</APPLET>
The opening applet tag contains a number of standard attributes:
code
Tells the browser which applet will be used. Applets end with the suffix.
class or.jar. This attribute is required.

Figure 9-15: Code and images for using the lowsrc trick

<IMG LOWSRC="lowres.gif" SRC="skyline.gif">

“lowres.gif” “skyline.gif”
Free download pdf