案例:javascript案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<!DOCTYPE html>
2
<html>
3
<body>
4
5
<h3>演示如何创建 PARAM 元素</h3>
6
7
<p>点击按钮来创建包含内嵌音频文件的 OBJECT 和 PARAM 元素。</p>
8
9
<button onclick="myFunction()">试一下</button>
10
11
<script>
12
function myFunction()
13
{
14
var x = document.createElement("OBJECT");
15
x.setAttribute("data", "/img/horse.mp3");
16
x.setAttribute("id", "myObject");
17
document.body.appendChild(x);
18
19
var y = document.createElement("PARAM");
20
y.setAttribute("name", "autoplay");
21
y.setAttribute("value", "true");
22
document.getElementById("myObject").appendChild(y);
23
}
24
</script>
25
26
</body>
27
</html>
28