HTML DOM Document hasFocus() Method
- Nangungunang Pahina getElementsByTagName()
- Susunod na Pahina head
- Bumalik sa Nangungunang Pahina HTML DOM Documents
Definition and usage
If the document (or any element in the document) has gained focus, then hasFocus()
The method returns true
.
Kung hindi, ibabalik ang false
.
Example
Show if the document has focus:
if (document.hasFocus()) { text = "The document has focus."; } text = "The document does NOT have focus."; }
Syntax
document.hasFocus()
Parameter
None.
Return value
Type | Description |
---|---|
Boolean value |
Kung ang dokumento (o ang elemento ng dokumento) ay nagkaroon ng fokus, ito ay true. Kung hindi, ibabalik ang false. |
Sumusuporta ang browser.
Lahat ng mga browser ay sumusuporta. document.hasFocus()
:
Chrome | IE | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
Chrome | IE | Edge | Firefox | Safari | Opera |
Suporta | Suporta | Suporta | Suporta | Suporta | Suporta |
- Nangungunang Pahina getElementsByTagName()
- Susunod na Pahina head
- Bumalik sa Nangungunang Pahina HTML DOM Documents