HTML DOM type 属性

定义和用法

The type property sets or returns the MIME type of the target URL (like "text/css", "text/javascript", "image/gif", etc.).

语法

  1. linkObject.type=MIME_type

实例

The following example returns the MIME type of the target URL:

  1. <html>
  2. <head>
  3. <link rel="stylesheet" type="text/css"
  4. id="style1" href="try_dom_link.css" />
  5. </head>
  6. <body>
  7.  
  8. <script type="text/javascript">
  9. x=document.getElementById("style1");
  10. document.write("MIME type: " + x.type);
  11. </script>
  12.  
  13. </body>
  14. </html>