HTML HTML Tutorial HTML Forms HTML Graphics HTML Media HTML APIs HTML Tags



HTML Tag: param

The HTML tag <param> is used to define parameters for an object element. It is used in conjunction with the <object> tag to specify various parameters for the object being embedded in the web page.

The <param> tag is an empty tag, which means it does not have a closing tag. Instead, it uses attributes to define the parameters for the object. The most commonly used attributes for the <param> tag are:

  • name: Specifies the name of the parameter.
  • value: Specifies the value of the parameter.

Here is an example of how the <param> tag is used:

<object data="example.swf" type="application/x-shockwave-flash">
  <param name="movie" value="example.swf">
  <param name="quality" value="high">
</object>

In the example above, the <object> tag is used to embed a Flash animation in the web page. The data attribute specifies the location of the Flash file, and the type attribute specifies the MIME type of the file. The <param> tags are used to specify additional parameters for the Flash animation, such as the name of the movie and the quality of the animation.

Here are some other examples of how the <param> tag can be used:

Example 1: Setting the Autoplay Parameter

The following code sets the autoplay parameter for an embedded audio file:

<object data="example.mp3" type="audio/mpeg">
  <param name="autoplay" value="true">
</object>

Example 2: Setting the Width and Height Parameters

The following code sets the width and height parameters for an embedded video file:

<object data="example.mp4" type="video/mp4">
  <param name="width" value="640">
  <param name="height" value="360">
</object>

Example 3: Setting the FlashVars Parameter

The following code sets the FlashVars parameter for an embedded Flash animation:

<object data="example.swf" type="application/x-shockwave-flash">
  <param name="movie" value="example.swf">
  <param name="FlashVars" value="param1=value1&param2=value2">
</object>

The FlashVars parameter is used to pass variables to the Flash animation. In the example above, the FlashVars parameter is set to param1=value1&param2=value2, which means that the Flash animation will receive two variables: param1 with a value of value1, and param2 with a value of value2.

Example 4: Setting the PDF Parameters

The following code sets the src, type, and height parameters for an embedded PDF file:

<object data="example.pdf" type="application/pdf">
  <param name="src" value="example.pdf">
  <param name="type" value="application/pdf">
  <param name="height" value="500">
</object>

In this example, the data attribute is not used, and instead the src and type parameters are used to specify the location and MIME type of the PDF file. The height parameter is used to specify the height of the embedded PDF file.

Example 5: Setting the Wmode Parameter

The following code sets the wmode parameter for an embedded Flash animation:

<object data="example.swf" type="application/x-shockwave-flash">
  <param name="movie" value="example.swf">
  <param name="wmode" value="transparent">
</object>

The wmode parameter is used to specify the window mode for the Flash animation. In the example above, the wmode parameter is set to transparent, which means that the Flash animation will be transparent and will allow the underlying web page to show through.

Example 6: Setting the Loop Parameter

The following code sets the loop parameter for an embedded video file:

<object data="example.mp4" type="video/mp4">
  <param name="loop" value="true">
</object>

The loop parameter is used to specify whether the video should loop or not. In the example above, the loop parameter is set to true, which means that the video will loop continuously.

Example 7: Setting the Scale Parameter

The following code sets the scale parameter for an embedded Flash animation:

<object data="example.swf" type="application/x-shockwave-flash">
  <param name="movie" value="example.swf">
  <param name="scale" value="noscale">
</object>

The scale parameter is used to specify whether the Flash animation should be scaled or not. In the example above, the scale parameter is set to noscale, which means that the Flash animation will not be scaled.

Example 8: Setting the Start Parameter

The following code sets the start parameter for an embedded audio file:

<object data="example.mp3" type="audio/mpeg">
  <param name="start" value="10">
</object>

The start parameter is used to specify the start time for the audio file. In the example above, the start parameter is set to 10, which means that the audio file will start playing at the 10-second mark.

Example 9: Setting the Volume Parameter

The following code sets the volume parameter for an embedded audio file:

<object data="example.mp3" type="audio/mpeg">
  <param name="volume" value="50">
</object>

The volume parameter is used to specify the volume level for the audio file. In the example above, the volume parameter is set to 50, which means that the audio file will play at half volume.

Example 10: Setting Multiple Parameters

The following code sets multiple parameters for an embedded Flash animation:

<object data="example.swf" type="application/x-shockwave-flash">
  <param name="movie" value="example.swf">
  <param name="quality" value="high">
  <param name="FlashVars" value="param1=value1&param2=value2">
  <param name="wmode" value="transparent">
  <param name="scale" value="noscale">
</object>

In this example, multiple parameters are set for the Flash animation, including the name of the movie, the quality of the animation, the FlashVars variables, the window mode, and the scaling.

Conclusion

The <param> tag is a powerful tool for specifying parameters for embedded objects in web pages. By using the <param> tag, web developers can customize the behavior and appearance of embedded objects, such as Flash animations, audio files, and video files. With its simple syntax and powerful attributes, the <param> tag is an essential part of any web developer's toolkit.

References

Activity