• Skip to main content
  • Skip to search
  • Skip to select language
MDN Web Docs
  • References
    • Overview / Web Technology

      Web technology reference for developers

    • HTML

      Structure of content on the web

    • CSS

      Code used to describe document style

    • JavaScript

      General-purpose scripting language

    • HTTP

      Protocol for transmitting web resources

    • Web APIs

      Interfaces for building web applications

    • Web Technology

      Web technology reference for developers

  • Guides
    • Overview / MDN Learning Area

      Learn web development

    • MDN Learning Area

      Learn web development

    • HTML

      Learn to structure web content with HTML

    • CSS

      Learn to style content using CSS

    • JavaScript

      Learn to run scripts in the browser

    • Accessibility

      Learn to make the web accessible to all

  • MDN Plus
    • Overview

      More MDN. Your MDN.

    • FAQ

      Frequently asked questions about MDN Plus

  • Already a subscriber?
  • Get MDN Plus
  1. Technologie Internetowe dla developerów
  2. Lista Web API
  3. document
  4. document.hasFocus

This page was translated from English by the community, but it's not maintained and may be out-of-date. To help maintain it, learn how to activate locales.

Related Topics

  1. Document
  2. Constructor
    1. Document() (en-US)
  3. Własności
    1. activeElement
    2. Deprecated alinkColor
    3. Deprecated all (en-US)
    4. Deprecated anchors
    5. Deprecated applets
    6. Deprecated bgColor
    7. body
    8. characterSet
    9. childElementCount (en-US)
    10. children (en-US)
    11. compatMode
    12. contentType (en-US)
    13. currentScript (en-US)
    14. defaultView
    15. designMode
    16. dir (en-US)
    17. doctype
    18. documentElement
    19. documentURI (en-US)
    20. Deprecated domain
    21. embeds
    22. featurePolicy (en-US)
    23. Deprecated fgColor
    24. firstElementChild (en-US)
    25. fonts (en-US)
    26. forms
    27. Deprecated fullscreen (en-US)
    28. fullscreenElement (en-US)
    29. fullscreenEnabled (en-US)
    30. head
    31. Deprecated height
    32. hidden (en-US)
    33. images
    34. implementation
    35. lastElementChild (en-US)
    36. lastModified
    37. Deprecated lastStyleSheetSet (en-US)
    38. Deprecated linkColor
    39. links
    40. location
    41. Non-Standard mozSyntheticDocument (en-US)
    42. Non-Standard msCapsLockWarningOff (en-US)
    43. Experimental Deprecated origin (en-US)
    44. pictureInPictureElement (en-US)
    45. pictureInPictureEnabled (en-US)
    46. plugins
    47. pointerLockElement (en-US)
    48. Deprecated preferredStyleSheetSet (en-US)
    49. readyState (en-US)
    50. referrer
    51. Deprecated rootElement (en-US)
    52. scripts (en-US)
    53. scrollingElement (en-US)
    54. Deprecated selectedStyleSheetSet (en-US)
    55. styleSheets
    56. Deprecated styleSheetSets (en-US)
    57. Experimental timeline (en-US)
    58. title
    59. URL
    60. visibilityState (en-US)
    61. Deprecated vlinkColor
    62. Deprecated width
    63. Deprecated xmlEncoding (en-US)
    64. Deprecated xmlVersion (en-US)
  4. Metody
    1. adoptNode() (en-US)
    2. append() (en-US)
    3. caretPositionFromPoint() (en-US)
    4. Non-Standard caretRangeFromPoint() (en-US)
    5. Deprecated clear()
    6. close()
    7. createAttribute()
    8. createAttributeNS() (en-US)
    9. createCDATASection() (en-US)
    10. createComment() (en-US)
    11. createDocumentFragment()
    12. createElement()
    13. createElementNS() (en-US)
    14. Deprecated createEntityReference() (en-US)
    15. createEvent()
    16. createExpression() (en-US)
    17. createNodeIterator() (en-US)
    18. createNSResolver() (en-US)
    19. createProcessingInstruction() (en-US)
    20. createRange()
    21. createTextNode()
    22. Deprecated createTouch() (en-US)
    23. Deprecated createTouchList() (en-US)
    24. createTreeWalker() (en-US)
    25. elementFromPoint() (en-US)
    26. elementsFromPoint() (en-US)
    27. Deprecated enableStyleSheetsForSet() (en-US)
    28. evaluate() (en-US)
    29. Deprecated execCommand()
    30. exitFullscreen() (en-US)
    31. exitPictureInPicture() (en-US)
    32. Experimental exitPointerLock() (en-US)
    33. getAnimations() (en-US)
    34. getElementById()
    35. getElementsByClassName()
    36. getElementsByName()
    37. getElementsByTagName()
    38. getElementsByTagNameNS() (en-US)
    39. getSelection() (en-US)
    40. hasFocus()
    41. hasStorageAccess() (en-US)
    42. importNode()
    43. Non-Standard mozSetImageElement() (en-US)
    44. open()
    45. prepend() (en-US)
    46. Deprecated queryCommandEnabled() (en-US)
    47. Deprecated queryCommandSupported() (en-US)
    48. querySelector()
    49. querySelectorAll() (en-US)
    50. Deprecated registerElement() (en-US)
    51. releaseCapture()
    52. replaceChildren() (en-US)
    53. requestStorageAccess() (en-US)
    54. write()
    55. writeln()
  5. Events
    1. Non-Standard afterscriptexecute (en-US)
    2. animationcancel (en-US)
    3. animationend (en-US)
    4. animationiteration (en-US)
    5. animationstart (en-US)
    6. Non-Standard beforescriptexecute (en-US)
    7. copy (en-US)
    8. cut (en-US)
    9. DOMContentLoaded (en-US)
    10. drag
    11. dragend (en-US)
    12. dragenter (en-US)
    13. dragleave (en-US)
    14. dragover (en-US)
    15. dragstart (en-US)
    16. drop (en-US)
    17. fullscreenchange (en-US)
    18. fullscreenerror (en-US)
    19. gotpointercapture (en-US)
    20. keydown (en-US)
    21. Deprecated keypress (en-US)
    22. keyup (en-US)
    23. lostpointercapture (en-US)
    24. Non-Standard mssitemodejumplistitemremoved (en-US)
    25. Non-Standard msthumbnailclick (en-US)
    26. paste (en-US)
    27. pointercancel (en-US)
    28. pointerdown (en-US)
    29. pointerenter (en-US)
    30. pointerleave (en-US)
    31. pointerlockchange (en-US)
    32. pointerlockerror (en-US)
    33. pointermove (en-US)
    34. pointerout (en-US)
    35. pointerover (en-US)
    36. pointerup (en-US)
    37. readystatechange (en-US)
    38. scroll (en-US)
    39. selectionchange (en-US)
    40. selectstart (en-US)
    41. touchcancel (en-US)
    42. touchend (en-US)
    43. touchmove (en-US)
    44. touchstart (en-US)
    45. transitioncancel (en-US)
    46. transitionend (en-US)
    47. transitionrun (en-US)
    48. transitionstart (en-US)
    49. visibilitychange (en-US)
    50. wheel (en-US)
  6. Inheritance:
    1. Node (en-US)
    2. EventTarget (en-US)

document.hasFocus

Podsumowanie

Własność hasFocus zwraca wartość true, jeżeli fokus jest zlokalizowany w dowolnym miejscu danego dokumentu.

null

Składnia

focused = document.hasFocus();

Przykład

Specyfikacja

Zarządzanie fokusem

 

 

 

 

Last modified: 8 gru 2020, by MDN contributors

MDN logo

Your blueprint for a better internet.

  • MDN on Twitter
  • MDN on GitHub

MDN

  • About
  • Hacks Blog
  • Careers

Support

  • Product help
  • Report a page issue
  • Report a site issue

Our communities

  • MDN Community
  • MDN Forum
  • MDN Chat

Developers

  • Web Technologies
  • Learn Web Development
  • MDN Plus
Mozilla logo
  • Website Privacy Notice
  • Cookies
  • Legal
  • Community Participation Guidelines

Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2022 by individual mozilla.org contributors. Content available under a Creative Commons license.