|Contained in||APPLET, OBJECT|
The PARAM element provides parameters for the OBJECT and APPLET elements. An OBJECT or APPLET may contain any number of PARAM elements prior to the alternate content that is also contained within the OBJECT or APPLET element.
The required NAME attribute of PARAM gives the name of the parameter while the VALUE attribute gives the parameter's value. The parameters recognized are specific to the kind of object being embedded or to the plug-in that renders the embedded object. For example, a clock applet may accept parameters to specify the style of the clock and the colors to use:
<OBJECT CLASSID="java:Clock.class" CODETYPE="application/java" WIDTH=100 HEIGHT=100 TITLE="A real live clock!" STANDBY="Do you know what time it is?">
<PARAM NAME=TYPE VALUE=ANALOG>
<PARAM NAME=BGCOLOR VALUE=WHITE>
<PARAM NAME=FGCOLOR VALUE=NAVY>
Note that the PARAM elements used in the preceding example would not change if the APPLET element were used in place of OBJECT.
Objects such as videos, audio clips, and Flash animations are typically handled by browser plug-ins. Each plug-in recognizes certain parameters, which can make choosing parameters difficult when the author does not know which plug-in the user has. However, unsupported parameters should be safely ignored. The following example uses parameters specific to the QuickTime movie plug-in as well as parameters specific to the LiveAudio audio plug-in:
<OBJECT DATA="mlk.mov" TYPE="video/quicktime" TITLE="Martin Luther King's "I Have a Dream" speech" WIDTH=150 HEIGHT=150>
<PARAM NAME=pluginspage VALUE="http://quicktime.apple.com/">
<PARAM NAME=autoplay VALUE=true>
<OBJECT DATA="mlk.wav" TYPE="audio/x-wav" TITLE="Martin Luther King's "I Have a Dream" speech">
<PARAM NAME=autostart VALUE=true>
<PARAM NAME=hidden VALUE=true>
<A HREF="mlk.html">Full text of Martin Luther King's "I Have a Dream" speech</A>
Note that only the parameters specified within the OBJECT and prior to the alternate content are passed onto the plug-in, so that the pluginspage and autoplay parameters are used if the QuickTime movie is played while the autostart and hidden parameters are used if the audio clip is played.
The VALUETYPE attribute of PARAM designates the type of the VALUE attribute. The default value for VALUETYPE is data, which indicates that the VALUE attribute contains a string.
The ref value for VALUETYPE indicates that the VALUE attribute contains a URI where run-time values are stored. The Internet media type of the resource is specified by the TYPE attribute. The following example uses values with VALUETYPE=ref to specify the location of images to animate and a sound to play during the animation:
<OBJECT CLASSID="java:Animator.class" CODETYPE="application/java" WIDTH=200 HEIGHT=300 TITLE="Wedding Photos">
<PARAM NAME=IMAGE1 VALUE="images/wedding/bride.jpg" VALUETYPE=ref TYPE="image/jpeg">
<PARAM NAME=IMAGE2 VALUE="images/wedding/groom.jpg" VALUETYPE=ref TYPE="image/jpeg">
<PARAM NAME=IMAGE3 VALUE="images/wedding/cake.jpg" VALUETYPE=ref TYPE="image/jpeg">
<PARAM NAME=SOUND VALUE="http://www.example.com/sounds/weddingmarch.mid" VALUETYPE=ref TYPE="audio/midi">
The URI specified by VALUE is passed to the object without being resolved to a full URL. In the preceding example, the Java class would be responsible for resolving and fetching the contents of partial URIs like "images/wedding/cake.jpg".
VALUETYPE also takes an object value, for use when a VALUE attribute specifies an identifier of a separate OBJECT in the document. The following example features a hypothetical application for interactively walking through the frames of an animated GIF. The GIF is loaded in a separate OBJECT from the application that uses it.
<OBJECT DECLARE ID=mygif DATA="animation.gif" TYPE="image/gif">
<PARAM NAME=image VALUE="#mygif" VALUETYPE=object>
<IMG SRC="animation.gif" ALT="[Example of an animated GIF]">