ล่าสุดการพัฒนาเว็บบทเรียน
×

HTML การอ้างอิง

HTML ตามลำดับตัวอักษร (เรียงลำดับ) HTML ตามหมวดหมู่ (เรียงลำดับ) HTML แอตทริบิวต์ HTML แอตทริบิวต์ทั่วโลก HTML เหตุการณ์ HTML ผ้าใบ HTML เสียง / วิดีโอ HTML doctypes HTML เข้ารหัส URL HTML รหัสภาษา HTML รหัสประเทศ HTTP ข้อความ HTTP วิธีการ PX จะ EM แปลง แป้นพิมพ์ลัด


 

HTML autofocus Attribute


ความหมายและการใช้งาน

autofocus แอตทริบิวต์เป็นแอตทริบิวต์แบบบูล

เมื่อปัจจุบันก็ระบุว่าองค์ประกอบที่ควรจะได้รับโดยอัตโนมัติเน้นเมื่อโหลดหน้าเว็บ


นำไปใช้กับ

autofocus แอตทริบิวต์ที่สามารถใช้กับองค์ประกอบต่อไปนี้:

องค์ประกอบ คุณลักษณะ
<button> autofocus
<input> autofocus
<keygen> autofocus
<select> autofocus
<textarea> autofocus

ตัวอย่าง

Button ตัวอย่าง

ปุ่มพร้อมออโต้โฟกัส:

<button type="button" autofocus>Click Me!</button>
ลองตัวเอง»

Input ตัวอย่าง

ปล่อยให้ "First name" ช่องใส่ได้รับโดยอัตโนมัติโฟกัสเมื่อโหลดหน้านี้:

<form action="demo_form.asp">
  First name: <input type="text" name="fname" autofocus><br>
  Last name: <input type="text" name="lname"><br>
  <input type="submit">
</form>
ลองตัวเอง»

Keygen ตัวอย่าง

ปล่อยให้ "Encryption" ข้อมูลโดยอัตโนมัติได้รับการโฟกัสเมื่อโหลดหน้าเว็บ:

<form action="demo_keygen.asp" method="get">
  Username: <input type="text" name="usr_name">
  Encryption: <keygen name="security" autofocus>
  <input type="submit">
</form>
ลองตัวเอง»

Textarea ตัวอย่าง

พื้นที่ข้อความที่มี autofocus :

<textarea autofocus>
At w3ii.com you will learn how to make a website. We offer free tutorials in all web development technologies.
</textarea>
ลองตัวเอง»

สนับสนุนเบราว์เซอร์

autofocus แอตทริบิวต์มีการสนับสนุนเบราว์เซอร์ต่อไปนี้สำหรับแต่ละองค์ประกอบ:

ธาตุ
form 5.0 10.0 4.0 5.0 9.6
input 5.0 10.0 4.0 5.0 9.6
keygen ใช่ ได้รับการสนับสนุน ได้รับการสนับสนุน 6.0 ใช่
textarea ใช่ 10.0 4.0 ใช่ ใช่