Javascript examples for DOM HTML Element:Anchor
The type property sets or gets the value of the type attribute of a link.
The type attribute sets the MIME type of the target URL in the area.
Set the type property with the following Values
Value | Description |
---|---|
MIME-type | Sets the MIME type of the linked document. |
A String, representing the MIME type of the linked document
The following code shows how to Return the MIME type of a specific link:
<!DOCTYPE html> <html> <body> <p><a type="text/html" id="myAnchor" href="https://www.java2s.com">java2s.com</a></p> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/*from www . j a va 2s. co m*/ var v = document.getElementById("myAnchor").type; document.getElementById("demo").innerHTML = v; } </script> </body> </html>