ข้อมูลอ้างอิงHTML

HTML โดยตัวอักษร HTML ตามหมวดหมู่ รองรับ HTML Browser แอตทริบิวต์ HTML HTML Global Attributes เหตุการณ์ HTML HTML สี HTML Canvas HTML เสียง/วิดีโอ ชุดอักขระ HTML HTML Doctypes การเข้ารหัส URL HTML รหัสภาษา HTML รหัสประเทศ HTML ข้อความ HTTP วิธี HTTP ตัวแปลง PX เป็น EM แป้นพิมพ์ลัด


HTML <input> srcแอตทริบิวต์

❮ แท็ก HTML <input>

ตัวอย่าง

แบบฟอร์ม HTML ที่มีรูปภาพแทนปุ่มส่ง:

<form action="/action_page.php">
  <label for="fname">First name:</label>
  <input type="text" id="fname" name="fname"><br><br>
  <input type="image" src="submit.gif" alt="Submit" width="48" height="48">
</form>

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

แอตทริบิวต์srcระบุ URL ของรูปภาพที่จะใช้เป็นปุ่มส่ง

หมายเหตุ:แอตทริบิวต์srcสามารถใช้ได้กับ (และจำเป็นสำหรับ) <input type="image">เท่านั้น


รองรับเบราว์เซอร์

ตัวเลขในตารางระบุเบราว์เซอร์รุ่นแรกที่สนับสนุนแอตทริบิวต์อย่างเต็มที่

Attribute
src Yes Yes Yes Yes Yes

ไวยากรณ์

<input src="URL">

ค่าแอตทริบิวต์

Value Description
URL Specifies the URL of the image to use as a submit button.

Possible values:

  • An absolute URL - points to another web site (like src="http://www.example.com/submit.gif")
  • A relative URL - points to a file within a web site (like src="submit.gif")

❮ แท็ก HTML <input>