Javascript examples for DOM HTML Element:Object
The type property sets or gets the type attribute of an <object> element.
The type attribute sets the MIME type of the object.
Set the type property with the following Values
Value | Description |
---|---|
media_type | Sets the Internet media type of the embedded content. |
A String, representing the Internet media type of the embedded content
The following code shows how to get the media type of the object:
<!DOCTYPE html> <html> <body> <object id="myObject" width="250" height="200" data="helloworld.swf" type="application/vnd.adobe.flash-movie"></object> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/*from w ww. j av a 2 s. c om*/ var x = document.getElementById("myObject").type; document.getElementById("demo").innerHTML = x; } </script> </body> </html>