Keygen autofocusProperty

Keygen 对象参考手册Keygen Object

Examples

Check whether the keygen field automatically gets focus when the page is loaded:

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

xThe output result is:

true

Try it Yourself »

Definition and Usage

The autofocus property is used to set or return whether the keygen field automatically gets focus when the page is loaded.

This property is the HTML autofocus attribute.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

All major browsers support the autofocus property, except Internet Explorer.

Note:The HTML autofocus attribute of the <keygen> element is not supported in Firefox.


Syntax

Return the autofocus property:

keygenObject.autofocus

Set the autofocus property:

keygenObject.autofocus=true|false

Property Values

Value Description
true|false Describes whether the keygen field gets focus when the page is loaded.
  • true - the keygen field gets focus
  • false - Default. The keygen field does not get focus

Technical Details

Return Value: A Boolean value, returns true if the keygen field automatically gets focus when the page is loaded, otherwise returns false.


Related Pages

HTML Reference Manual:HTML <keygen> autofocus attribute


Keygen 对象参考手册Keygen Object

Other Extensions