Thuộc tính kiểu Gửi đầu vào HTML DOM được liên kết với phần tử đầu vào có kiểu =”submit”. Nó sẽ luôn trả về gửi cho phần tử gửi đầu vào.
Cú pháp
Sau đây là cú pháp cho thuộc tính loại gửi -
submitObject.type
Ví dụ
Hãy để chúng tôi xem xét một ví dụ cho thuộc tính loại gửi -
<!DOCTYPE html>
<html>
<body>
<h1>Input range type Property</h1>
<form>
VOLUME <input type="range" id="RANGE1" name="VOL">
</form>
<p>Get the above input element type by clicking the below button</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> Đầu ra
Điều này sẽ tạo ra kết quả sau -
Khi nhấp vào nút “GET Type” -