Here is the DTD for the applet tag. This tag is supported by the Netscape Navigator 2.0 and by the beta version of HotJava and is the standard to be supported by other "java enabled" browsers.

<!ELEMENT APPLET - - (PARAM*, (%text;)*)>
<!ATTLIST APPLET
	CODEBASE CDATA #IMPLIED  -- code base --
	CODE CDATA #REQUIRED     -- code file --
	ALT CDATA  #OPTIONAL	 -- alternate text --
	NAME CDATA #IMPLIED      -- applet name --
	WIDTH NUMBER #REQUIRED
	HEIGHT NUMBER #REQUIRED
	ALIGN (left|right|top|texttop|middle|
		absmiddle|baseline|bottom|absbottom) baseline
	VSPACE NUMBER #IMPLIED
	HSPACE NUMBER #IMPLIED
>

<!ELEMENT PARAM - O EMPTY>
<!ATTLIST PARAM
	NAME NAME #REQUIRED     -- The name of the parameter --
	VALUE CDATA #IMPLIED    -- The value of the parameter --
>
Applet resources (including their classes) are normally loaded relative to the document-URL (or <base> tag if it is defined). The codebase attribute is used to change this default behavior. If the codebase attribute is defined then it specifies a different location to find applet resources. The value can be an absolute URL or a relative URL. The absolute URL is used as is without modification and is not effected by the documents <base> tag. When the codebase attribute is relative, then it is relative to the document-URL (or <base> tag if defined).


Here is an example:

<applet codebase="applets/NervousText"
	code=NervousText.class
	width=300
	height=50>
<param name=text value="Java is Cool!">
</applet>
Which causes this to appear:


Data from the applet tag (code, codebase, name, alt, width, height, align, vspace and hspace) is made available to the applet. In addition, any parameters defined in the <param> tags are also made available to the applet. The applet invokes the getParameter method to get a String that contains the value of one of the above parameters. See the Applet class documentation for more information.

Applet resources are loaded relative to the codebase, including images, audio files, etc. However, the applet does have access to the document-URL if resources from that location are desired.

Here is an example of how applet code can reference a resource from the codebase (this should be used when resources are accessed that are referenced directly from within the applet code):

Image img = getImage(new URL(getBaseURL(), "images/cross.gif"));
And here is an example of how applet code can reference a resource from the document-URL (this should be used when resources are accessed that are specified in an applet parameter, and which are therefore relative to the document's base):

Image img = getImage(new URL(getDocumentURL(), getParameter("src")));