如何在 HTML 中为对象添加参数?
htmlfront end technologyweb development更新于 2026/1/16 2:52:17
我们使用 <param> 标签为与 object 元素关联的插件定义参数。<param> 标签不包含结束标签。<param> 标签支持所有浏览器,但 object 中定义的文件格式可能不支持。它也支持 HTML 中的全局属性和事件属性。
语法
以下是 HTML 中 <param> 标签的用法 −
<param name=" " value=" ">
HTML 中的 parameter 标签接受四个属性,如下所示 −
name − param 标签中的 name 属性用于指定参数的名称。
value − param 标签中的 value 属性用于指定参数的值。
type − param 标签中的 type 属性用于指定媒体类型。
valuetype − valuetype 属性用于指定值的类型。
示例
以下示例演示如何在 HTML 中为对象添加参数 −
<!DOCTYPE html>
<html>
<body>
<h1>Welcome To TutorialsPoint</h1>
<h2>Demonstration of param Tag</h2>
<object data= "https://storage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4">
<param name="video" value="play">
</object>
</body>
</html>
示例
以下示例中,我们尝试使用 <object> 标签将图像插入 HTML 页面,并尝试使用 <param> 标签向其添加参数 –
<!DOCTYPE html>
<html>
<head>
<title> Defining a parameter for an object using HTML </title>
<style>
body {
text-align: center;
}
h1 {
color: blue;
}
</style>
</head>
<body>
<h1>TutorialsPoint</h1>
<h2>How to add a parameter for an object in HTML </h2>
<object data="https://www.cainiaomax.com/static/images/logo.png?v2">
<param name="autoplay" value="true">
</object>
</body>
</html>
示例
以下是另一个示例 −
<!DOCTYPE html>
<html>
<head>
<title>HTML param Tag</title>
</head>
<body>
<h1>Demonstration of param Tag</h1>
<object title="Test Object." data="https://storage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4">
<param name="audio" value="autoplay" />
<param name="width" value="900" />
<param name="height" value="200" />
</object>
</body>
</html>
相关文章
有用资源
html 参考教程 - 该教程包含有关 html 的更多信息:https://www.cainiaomax.com/html/

