HTML <รูปแบบ> ชื่อแอตทริบิวต์
ตัวอย่าง
แบบฟอร์ม HTML ที่มีแอตทริบิวต์ชื่อ:
<form
action="/action_page.php"
method="get" name="myForm">
<label for="fname">First name:</label>
<input type="text" id="fname"
name="fname"><br><br>
<label for="lname">Last name:</label>
<input type="text" id="lname" name="lname"><br><br>
<input
type="button" onclick="formSubmit()" value="Send form data!">
</form>
ความหมายและการใช้งาน
แอตทริบิวต์name
ระบุชื่อของแบบฟอร์ม
คุณลักษณะname
นี้ใช้เพื่ออ้างอิงองค์ประกอบใน JavaScript หรือเพื่ออ้างอิงข้อมูลแบบฟอร์มหลังจากส่งแบบฟอร์ม
รองรับเบราว์เซอร์
Attribute | |||||
---|---|---|---|---|---|
name | Yes | Yes | Yes | Yes | Yes |
ไวยากรณ์
<form name="text">
ค่าแอตทริบิวต์
Value | Description |
---|---|
text | Specifies the name of the form |
❮ แท็ก HTML <form>