如何在 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>

更新於: 23-May-2020

158 瀏覽

助力你的 職業生涯

完成課程獲得認證

開始
廣告
© . All rights reserved.