Input FileUpload autofocus eigenschap

Definitie en gebruik

autofocus Stel in of geef terug of de knop voor het uploaden van bestanden automatisch het focus krijgt bij het laden van de pagina.

Deze eigenschap reflecteert de HTML autofocus eigenschap.

Zie ook:

HTML Referentie Handboek:HTML <input> autofocus attribute

Voorbeeld

Bevestig of de knop voor het uploaden van bestanden automatisch het focus krijgt bij het laden van de pagina:

var x = document.getElementById("myFile").autofocus;

Probeer het zelf

语法

Geef de autofocus-eigenschap terug:

fileuploadObject.autofocus

Stel de autofocus-eigenschap in:

fileuploadObject.autofocus = true|false

eigenschapswaarde

waarde omschrijving
true|false

Specifies whether the file upload button should gain focus when the page is loaded.

  • true - The file upload button gains focus
  • false - Default. The file upload button does not gain focus

Technical details

Return value: Boolean value, if the file upload button automatically gains focus when the page is loaded, it returns true; otherwise return false.

Browser support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support 10.0 Support Support Support