如何在 JavaScript 中搜索链接的 target 属性值?
htmljavascriptprogramming scripts更新于 2026/1/14 19:56:17
要在 JavaScript 中搜索链接的 target 属性值,请使用 target 属性。您可以尝试运行以下代码来获取 target 属性的值。
示例
<!DOCTYPE html>
<html>
<body>
<p><a id = "qriesid" target="_self" href = "https://qries.com/" type = "text/html" >Qries</a></p>
<script>
var x = document.getElementById("qriesid").target;
document.write("Value of the target attribute: "+x);
</script>
</body>
</html>
相关文章
有用资源
html 参考教程 - 该教程包含有关 html 的更多信息:https://www.cainiaomax.com/html/

