Objek Input Image DOM HTML

Objek Input Gambar

Objek Input Gambar adalah objek baru dalam HTML5.

Objek Input Gambar mewakili elemen HTML <image>.

Penggunaan Objek Input Gambar

You can access the <image> element using getElementById():

var x = document.getElementById("myImage");

Hint:You can also traverse the form's elements collection to access the Input Image object.

Create Input Image Object

You can create an <image> element using the document.createElement() method:

var x = document.createElement("INPUT");
x.setAttribute("type", "image");

Properties of Input Image Object

Atribut Description
autocomplete Set or return the autocomplete attribute value of the email field.
alt Set or return the alt attribute value of the input image.
autofocus Set or return whether the input image should automatically focus after page loading.
defaultValue Set or return the default value of the input image.
disabled Set or return whether the input image is disabled.
form Return a reference to the form that contains the input image.
formAction Set or return the formaction attribute of the input image.
formEnctype Set or return the formenctype attribute of the input image.
formMethod Set or return the formmethod attribute of the input image.
formNoValidate Set or return whether the form data should be validated when submitting the form.
formTarget Set or return the formtarget attribute of the input image.
height Set or return the height attribute of the input image.
name Set or return the name attribute of the input image.
src Set or return the src attribute of the input image.
type Return the form element type of the input image field.
value Set or return the value attribute of the input image.
lebar Atur atau carikan nilai atribut lebar image input.

Atribut piawaian dan peristiwa

Objek Gambar Input mendukung piawaianAtributdanPeristiwa.

Laman berkaitan

Panduan HTML:Borang HTML

Panduan referensi HTML:Tanda <input> HTML

Panduan referensi HTML:Atur atribut type <input> HTML