要获取JavaScript中链接的type属性的值,请使用type属性。type属性用于判断文档是html(text / html)还是css(text / css)等。
您可以尝试运行以下代码来获取链接的type属性的值。
<!DOCTYPE html> <html> <body> <p><a id="anchorid" type="text/html" target= "_blank" href="https://www.qries.com/">Qries</a></p> <script> var myVal = document.getElementById("anchorid").type; document.write("Value of type attribute: "+myVal); </script> </body> </html>