HTML DOM tabIndex Property
ตัวอย่าง
เปลี่ยนลำดับแท็บสำหรับสามลิงก์:
document.getElementById("myAnchor1").tabIndex = "3";
document.getElementById("myAnchor2").tabIndex = "2";
document.getElementById("myAnchor3").tabIndex = "1";
ตัวอย่าง "ลองใช้เอง" เพิ่มเติมด้านล่าง
ความหมายและการใช้งาน
คุณสมบัติ tabIndex ตั้งค่าหรือคืนค่าของแอตทริบิวต์ tabindex ขององค์ประกอบ
แอตทริบิวต์ tabindex ระบุลำดับแท็บขององค์ประกอบ (เมื่อใช้ปุ่ม "tab" สำหรับการนำทาง)
รองรับเบราว์เซอร์
Property | |||||
---|---|---|---|---|---|
tabIndex | Yes | Yes | Yes | Yes | Yes |
ไวยากรณ์
ส่งคืนคุณสมบัติ tabIndex:
HTMLElementObject.tabIndex
ตั้งค่าคุณสมบัติ tabIndex:
HTMLElementObject.tabIndex = number
มูลค่าทรัพย์สิน
Value | Description |
---|---|
number | Specifies the tabbing order of the element (1 is first). Note: If the number is negative, the element will be removed from the tab order |
รายละเอียดทางเทคนิค
คืนมูลค่า: | ตัวเลข แทนลำดับแท็บขององค์ประกอบ |
---|
ตัวอย่างเพิ่มเติม
ตัวอย่าง
รับลำดับแท็บขององค์ประกอบ <a> แรก (ดัชนี 0) ในเอกสาร:
var x = document.getElementsByTagName("A")[0].tabIndex;
document.getElementById("demo").innerHTML = x;
หน้าที่เกี่ยวข้อง
การอ้างอิง HTML: HTML tabindex Attribute
❮ วัตถุธาตุ