The Basic <applet> Tag


[Home][Index][Previous][Next]
The <applet>...</applet> tag tells the browser how to display the applet on the page. Studying some of the sample HTML files included with the applet will help you "get the feel" of embedding AppletQuiz in a web page, but a few remarks explaining what some parts of the applet tag do might be in order also. A typical (simple) applet tag might look like this:

<applet 
codebase="AQ3" 
code="AppletQuiz.class" 
width=400 height=350 archive="TestApplet.zip">
You need a Java-enabled browser to take this quiz.
</applet>

Most of the applet tag shown above does not need to change from page to page. For instance, the 'code = "AppleetQuiz.class"' and 'archive="TestApplet.zip"' should never be changed. Items that you may need to adjust are described briefly below.


Codebase

It is usually convenient to organize files into directories and folders, with, perhaps, HTML files in one folder, graphics in another, and applet code in another. The codebase keyword tells the browser where to find the file "AppletQuiz.class" relative to the current HTML file. In the example above, the "AppletQuiz.class" file is located in a subdirectory of the location of the HTML file called "AQ3".

For other examples of the use of the codebase keyword, see the sample AppletQuiz files, or consult a reference on HTML.


Height & Width

The "width= 400 height=300" in the applet tag above specify the size of the rectangle that the browser should use to display the AppletQuiz applet. The values shown (400 and 300) represent a reasonable default, but you may change them if you wish.

If your questions are not very "wordy" you may want to adjust the height and width to smaller values so that the applet takes up less room on the page. If you have questions that contain a lot of graphics or large text, these dimensions may need to be increased.

It is up to you to adjust the width and height of the applet so that the complete text and graphics of every question, as well as all of the necessary buttons, are displayed for your quiz.


[Home][Index][Previous][Next]
last update May 12, 1999 by JL Stanbrough