Düğme tipi Özellik
Örnek
Bir düğmenin türünü döndürür:
var x = document.getElementById("myBtn").type;
Tanım ve Kullanım
type özelliği, bir düğmenin türünü ayarlar veya döndürür.
İpucu: Her zaman düğme için type niteliğini belirtin. Internet Explorer için varsayılan tür "düğme" iken, diğer tarayıcılarda (ve W3C belirtiminde) "gönder" şeklindedir.
Tarayıcı Desteği
Property | |||||
---|---|---|---|---|---|
type | Yes | Yes | Yes | Yes | Yes |
Sözdizimi
type özelliğini döndürün:
buttonObject.type
type özelliğini ayarlayın:
buttonObject.type = "submit|button|reset"
Mülk değerleri
Value | Description |
---|---|
submit | The button is a submit button (this is default for all browsers, except Internet Explorer) |
button | The button is a clickable button (this is default for Internet Explorer) |
reset | The button is a reset button (clears form data) |
Teknik detaylar
Geri dönüş değeri: | Düğme türünü temsil eden bir Dize |
---|
Daha fazla örnek
Örnek
Bir düğmenin türünü "gönder" olarak değiştirin:
document.getElementById("myBtn").type = "submit";
Örnek
Bir düğmenin türünü "sıfırla" olarak değiştirin:
document.getElementById("myBtn").type = "reset";
İlgili Sayfalar
HTML referansı: HTML <button> tipi özniteliği
❮ Düğme Nesnesi