SVGNumber: thuộc tính value

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 value của giao diện SVGNumber đại diện cho số.

Giá trị

Một số thực.

Ví dụ

Truy cập thuộc tính value

html
<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200">
  <circle id="myCircle" cx="100" cy="100" r="50" fill="blue" />
</svg>
js
const circleElement = document.getElementById("myCircle");

// Access the radius (r) value property
const radiusValue = circleElement.r.baseVal.value;

console.log(radiusValue); // Output: 50

Thông số kỹ thuật

Thông số kỹ thuật
Scalable Vector Graphics (SVG) 2
# __svg__SVGNumber__value

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