• 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 Extensions

      Developing extensions for web browsers

    • 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

      A customized MDN experience

    • Updates

      All browser compatibility updates at a glance

    • Documentation

      Learn how to use MDN Plus

    • FAQ

      Frequently asked questions about MDN Plus

  • Log in
  • Get MDN Plus
  1. Web 开发技术
  2. Web API 接口参考
  3. Window
  4. Window.blur()

此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

In this article

  • 总结
  • 语法
  • 示例
  • 注意
  • 规范
  1. Window
  2. 实例属性
    1. applicationCache 非标准 已弃用
    2. closed
    3. console
    4. content
    5. credentialless (en-US) 实验性 非标准
    6. customElements
    7. defaultStatus 已弃用
    8. devicePixelRatio
    9. document
    10. event 已弃用
    11. external 已弃用
    12. frameElement
    13. frames
    14. fullScreen 非标准
    15. history
    16. innerHeight
    17. innerWidth
    18. launchQueue (en-US) 实验性
    19. length
    20. localStorage
    21. location
    22. locationbar
    23. menubar
    24. mozInnerScreenX 非标准
    25. mozInnerScreenY 非标准
    26. name
    27. navigation (en-US) 实验性
    28. navigator
    29. ondragdrop 已弃用
    30. opener
    31. orientation (en-US) 已弃用
    32. outerHeight
    33. outerWidth
    34. pageXOffset
    35. pageYOffset
    36. parent
    37. personalbar
    38. scheduler (en-US)
    39. screen
    40. screenLeft
    41. screenTop
    42. screenX
    43. screenY
    44. scrollbars
    45. scrollMaxX 非标准
    46. scrollMaxY 非标准
    47. scrollX
    48. scrollY
    49. self
    50. sessionStorage
    51. sidebar 非标准 已弃用
    52. speechSynthesis (en-US)
    53. status (en-US) 已弃用
    54. statusbar (en-US)
    55. toolbar (en-US)
    56. top
    57. visualViewport
    58. window
  3. 实例方法
    1. alert()
    2. back() 非标准 已弃用
    3. blur()
    4. cancelAnimationFrame()
    5. cancelIdleCallback()
    6. captureEvents() (en-US) 非标准
    7. clearImmediate()
    8. close()
    9. confirm()
    10. convertPointFromNodeToPage() (en-US) 非标准
    11. dump() 非标准
    12. find() 非标准
    13. focus()
    14. forward() (en-US) 非标准 已弃用
    15. getComputedStyle()
    16. getDefaultComputedStyle() 非标准
    17. getSelection()
    18. matchMedia()
    19. moveBy()
    20. moveTo()
    21. open()
    22. postMessage()
    23. print()
    24. prompt()
    25. queryLocalFonts() (en-US) 实验性
    26. releaseEvents() (en-US) 已弃用
    27. requestAnimationFrame()
    28. requestFileSystem() 非标准 已弃用
    29. requestIdleCallback()
    30. resizeBy()
    31. resizeTo()
    32. scroll()
    33. scrollBy()
    34. scrollByLines() 非标准
    35. scrollByPages() 非标准
    36. scrollTo()
    37. setImmediate()
    38. showDirectoryPicker() (en-US) 实验性
    39. showModalDialog() 非标准 已弃用
    40. showOpenFilePicker() (en-US) 实验性
    41. showSaveFilePicker() (en-US) 实验性
    42. sizeToContent() 非标准
    43. stop()
    44. updateCommands() 非标准
    45. webkitConvertPointFromPageToNode() (en-US) 非标准 已弃用
  4. 事件
    1. afterprint
    2. appinstalled
    3. beforeinstallprompt
    4. beforeprint
    5. beforeunload
    6. blur
    7. copy
    8. cut (en-US)
    9. devicemotion
    10. deviceorientation
    11. deviceorientationabsolute
    12. DOMContentLoaded
    13. error
    14. focus
    15. gamepadconnected
    16. gamepaddisconnected
    17. hashchange
    18. languagechange
    19. load
    20. message
    21. messageerror
    22. offline
    23. online
    24. orientationchange 已弃用
    25. pagehide
    26. pageshow
    27. paste (en-US)
    28. popstate
    29. rejectionhandled
    30. resize
    31. storage
    32. unhandledrejection
    33. unload
    34. vrdisplayactivate (en-US) 非标准 已弃用
    35. vrdisplayconnect (en-US) 非标准 已弃用
    36. vrdisplaydeactivate (en-US) 非标准 已弃用
    37. vrdisplaydisconnect (en-US) 非标准 已弃用
    38. vrdisplaypresentchange (en-US) 非标准 已弃用
  5. 继承
    1. EventTarget

In this article

  • 总结
  • 语法
  • 示例
  • 注意
  • 规范

Window.blur()

总结

将焦点移出顶层窗口。

语法

window.blur()

示例

window.blur();

注意

使用 window.blur() 方法与用户主动将焦点移出顶层窗口本质上是一样的。

规范

Specification
HTML Standard
# dom-window-blur

Found a content problem with this page?

  • Edit the page on GitHub.
  • Report the content issue.
  • View the source on GitHub.
Want to get more involved? Learn how to contribute.

This page was last modified on 2022年9月21日 by MDN contributors.

MDN logo

Your blueprint for a better internet.

  • MDN on Twitter
  • MDN on GitHub

MDN

  • About
  • Hacks Blog
  • Careers
  • Advertise with us

Support

  • Product help
  • Report an 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–2023 by individual mozilla.org contributors. Content available under a Creative Commons license.