Javascript examples for DOM HTML Element:Link
The type property sets or gets the MIME type of the linked document.
Examples of MIME-types are: "text/css", "text/javascript", "image/gif", etc.
Set the type property with the following Values
Value | Description |
---|---|
MIME-type | The MIME type of the linked document. |
A String, representing the content type of the linked document
The following code shows how to return the MIME-type of the linked document:
<!DOCTYPE html> <html> <head> <link id="myLink" rel="stylesheet" type="text/css" href="styles.css"> </head>// w w w . ja v a2 s . c o m <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() { var x = document.getElementById("myLink").type; document.getElementById("demo").innerHTML = x; } </script> </body> </html>