SVGScriptElement: thuộc tính type

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

Thuộc tính chỉ đọc type của giao diện SVGScriptElement phản ánh thuộc tính type của phần tử <script> đã cho.

Giá trị

Một chuỗi.

Ví dụ

Truy cập thuộc tính type

html
<svg xmlns="http://www.w3.org/2000/svg" width="400" height="200">
  <script id="myScript" href="script.js" type="text/javascript"></script>
</svg>
js
const scriptElement = document.getElementById("myScript");

// Truy cập thuộc tính type
console.log(scriptElement.type); // Đầu ra: "text/javascript"

Thông số kỹ thuật

Specification
Scalable Vector Graphics (SVG) 2
# __svg__SVGScriptElement__type

Tương thích trình duyệt