要获取JavaScript中链接的rel属性的值,请使用rel属性。该版本被用于设置页面即遵循和以下状态nofollow的。
您可以尝试运行以下代码来获取链接的rel属性的值。
<!DOCTYPE html> <html> <body> <p><a id="anchorid" rel="nofollow" href="https://www.qries.com/">Qries</a></p> <script> var myVal = document.getElementById("anchorid").rel; document.write("Value of rel attribute: "+myVal); </script> </body> </html>