弃用
This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the
兼容性表格
at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.
注意: This page describes the Keygen Element interface as specified, not as currently implemented by Gecko. See bug 101019 for details and status.
<keygen>
elements expose the
HTMLKeygenElement
interface, which provides special properties and methods (beyond the regular
element
object interface they also have available to them by inheritance) for manipulating the layout and presentation of
keygen
元素。
布尔
that reflects the
autofocus
HTML attribute, indicating that the form control should have input focus when the page loads.
DOMString
that reflects the
challenge
HTML attribute, containing a challenge string that is packaged with the submitted key.
HTMLFormElement
that indicates the control's form owner, reflecting the
form
HTML attribute if it is defined.
DOMString
that reflects the
keytype
HTML attribute, containing the type of key used.
NodeList
that represents a list of label elements associated with this keygen element.
DOMString
that reflects the
名称
HTML attribute, containing the name for the control that is submitted with form data.
DOMString
that must be the value
keygen
.
DOMString
representing a localized message that describes the validation constraints that the control does not satisfy (if any). This is the empty string if the control is not a candidate for constraint validation (
willValidate
is false), or it satisfies its constraints.
ValidityState
representing the validity states that this element is in.
布尔
that is always false because
keygen
objects are never candidates for constraint validation.
| Name & Arguments | 返回 | 描述 |
|---|---|---|
checkValidity()
|
布尔
|
Always returns true because
keygen
objects are never candidates for constraint validation.
|
setCustomValidity(in DOMString error)
|
void
|
Sets a custom validity message for the element. If this message is not the empty string, then the element is suffering from a custom validity error, and does not validate. |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
HTMLKeygenElement
弃用
非标
|
Chrome
? — 57
|
Edge ? | Firefox 1 — 69 | IE ? | Opera No | Safari ? |
WebView Android
? — 57
|
Chrome Android
? — 57
|
Firefox Android
部分支持
4
|
Opera Android No | Safari iOS ? | Samsung Internet Android ? — 7.0 |
部分支持
不支持
兼容性未知
非标。预期跨浏览器支持较差。
弃用。不要用于新网站。
见实现注意事项。
HTMLKeygenElement
BeforeUnloadEvent
DOMStringMap
ErrorEvent
GlobalEventHandlers
HTMLAnchorElement
HTMLAreaElement
HTMLAudioElement
HTMLBRElement
HTMLBaseElement
HTMLBaseFontElement
HTMLBodyElement
HTMLButtonElement
HTMLCanvasElement
HTMLContentElement
HTMLDListElement
HTMLDataElement
HTMLDataListElement
HTMLDialogElement
HTMLDivElement
HTMLDocument
HTMLElement
HTMLEmbedElement
HTMLFieldSetElement
HTMLFormControlsCollection
HTMLFormElement
HTMLFrameSetElement
HTMLHRElement
HTMLHeadElement
HTMLHeadingElement
HTMLHtmlElement
HTMLIFrameElement
HTMLImageElement
HTMLInputElement
HTMLIsIndexElement
HTMLLIElement
HTMLLabelElement
HTMLLegendElement
HTMLLinkElement
HTMLMapElement
HTMLMediaElement
HTMLMetaElement
HTMLMeterElement
HTMLModElement
HTMLOListElement
HTMLObjectElement
HTMLOptGroupElement
HTMLOptionElement
HTMLOptionsCollection
HTMLOutputElement
HTMLParagraphElement
HTMLParamElement
HTMLPictureElement
HTMLPreElement
HTMLProgressElement
HTMLQuoteElement
HTMLScriptElement
HTMLSelectElement
HTMLShadowElement
HTMLSourceElement
HTMLSpanElement
HTMLStyleElement
HTMLTableCaptionElement
HTMLTableCellElement
HTMLTableColElement
HTMLTableDataCellElement
HTMLTableElement
HTMLTableHeaderCellElement
HTMLTableRowElement
HTMLTableSectionElement
HTMLTemplateElement
HTMLTextAreaElement
HTMLTimeElement
HTMLTitleElement
HTMLTrackElement
HTMLUListElement
HTMLUnknownElement
HTMLVideoElement
HashChangeEvent
历史
ImageData
定位
MessageChannel
MessageEvent
MessagePort
Navigator
NavigatorGeolocation
NavigatorID
NavigatorLanguage
NavigatorOnLine
NavigatorPlugins
PageTransitionEvent
Plugin
PluginArray
PopStateEvent
PortCollection
PromiseRejectionEvent
RadioNodeList
Transferable
ValidityState
Window
WindowBase64
WindowEventHandlers
WindowTimers