<html>
<body>
<object id="myObject" width="300" height="300" data="/i/photo/tulip.jpg" type="image/jpeg"></object>
<p>单击该按钮可显示对象的媒体类型。</p>
<button onclick="myFunction()">试一试</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = document.getElementById("myObject").type;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>