Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> JavaScript

วิธาสร้าง Tabbing Order (ลำดับ Tab) ขององค์ประกอบใน HTML

ใช้แอตทริบิวต์ tabindex เพื่อกำหนดลำดับการฟอกัสเมื่อกด Tab ค่าตัวเลขบวก: ลำดับที่จะฟอกัส, 0: ตามลำดับ HTML, -1: ไม่เข้าถึงได้ด้วย Tab

ตัวอย่าง

<!DOCTYPE html>
<html>
  <body>
    <a href="https://www.tutorialspoint.com/current_affairs/index.htm" tabindex="1">Current Affairs</a><br>
    <a href="https://www.tutorialspoint.com/codingground.htm" tabindex="2">Coding Ground</a><br>
    <a href="https://www.tutorialspoint.com/verbal_ability/index.htm" tabindex="4">Verbal Ability</a><br>
    <a href="https://www.tutorialspoint.com/quantitative_aptitude/index.htm" tabindex="3">Quantitative Aptitude</a><br>
    <p>We have changed the tab order above. Use TAB on keyboard to view the changes.</p>
  </body>
</html>