首頁  >  文章  >  web前端  >  如何在JavaScript中搜尋連結的type屬性的值?

如何在JavaScript中搜尋連結的type屬性的值?

PHPz
PHPz轉載
2023-08-31 10:21:07708瀏覽

如何在JavaScript中搜尋連結的type屬性的值?

要在 JavaScript 中搜尋連結的 type 屬性值,請使用 type 屬性。您可以嘗試執行以下程式碼來取得type屬性的值。

範例

<!DOCTYPE html>
<html>
   <body>
      <p><a id = "qriesid" href = "https://qries.com/" type="text/html" >Qries</a></p>
      <script>
         var x = document.getElementById("qriesid").type;
         document.write("Value of the type attribute: "+x);
      </script>
   </body>
</html>
#

以上是如何在JavaScript中搜尋連結的type屬性的值?的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文轉載於:tutorialspoint.com。如有侵權,請聯絡admin@php.cn刪除