คุณสมบัติ type ของ HTML DOM Input Submit เกี่ยวข้องกับองค์ประกอบ input ที่มี type=”submit” จะคืนค่า submit เสมอสำหรับองค์ประกอบ input submit
ไวยากรณ์
ไวยากรณ์สำหรับคุณสมบัติ type ของ submit:
submitObject.type
ตัวอย่าง
มาดูตัวอย่างสำหรับคุณสมบัติ type ของ submit:
<!DOCTYPE html> <html> <body> <h1>Input range type Property</h1> <form> VOLUME <input type="range" id="RANGE1" name="VOL"> </form> <p>ดึง type ขององค์ประกอบ input ด้านบนโดยคลิกปุ่มด้านล่าง</p> <button type="button" onclick="rangeType()">GET Type</button> <p id="Sample"></p> <script> function rangeType() { var P=document.getElementById("RANGE1").type; document.getElementById("Sample").innerHTML = "The type for the input field is: "+P ; } </script> </body> </html>
ผลลัพธ์
จะได้ผลลัพธ์ดังนี้:

เมื่อคลิกปุ่ม “GET Type”:
