• Skip to main content
  • Skip to search
  • Skip to select language
MDN Web Docs
  • 参考手册
    • 概述 / Web 技术

      适用于开发者的 Web 技术参考手册

    • HTML

      Web 内容的结构

    • CSS

      用于描述文档样式的代码

    • JavaScript

      通用脚本语言

  • 开发指南
    • 概述 / MDN 学习区

      学习 Web 开发

    • MDN 学习区

      学习 Web 开发

    • HTML

      学习使用 HTML 构建 Web 内容

    • CSS

      学习使用 CSS 设置内容样式

    • JavaScript

      学习在浏览器中运行脚本

  • 更多中文网
  1. 面向开发者的 Web 技术
  2. 网络 API
  3. Window
  4. length

目录

  • Value
  • Examples
  • Specifications
  • Browser compatibility
  1. Window
  2. Instance properties
    1. caches
    2. closed
    3. console
    4. cookieStore Experimental
    5. credentialless Experimental
    6. crossOriginIsolated
    7. crypto
    8. customElements
    9. devicePixelRatio
    10. document
    11. documentPictureInPicture Experimental
    12. event Deprecated
    13. external Deprecated
    14. fence Experimental
    15. frameElement
    16. frames
    17. fullScreen Non-standard
    18. history
    19. indexedDB
    20. innerHeight
    21. innerWidth
    22. isSecureContext
    23. launchQueue Experimental
    24. length
    25. localStorage
    26. location
    27. locationbar
    28. menubar
    29. mozInnerScreenX Non-standard
    30. mozInnerScreenY Non-standard
    31. name
    32. navigation Experimental
    33. navigator
    34. opener
    35. orientation Deprecated
    36. origin
    37. originAgentCluster Experimental
    38. outerHeight
    39. outerWidth
    40. parent
    41. performance
    42. personalbar
    43. scheduler
    44. screen
    45. screenLeft
    46. screenTop
    47. screenX
    48. screenY
    49. scrollbars
    50. scrollMaxX Non-standard
    51. scrollMaxY Non-standard
    52. scrollX
    53. scrollY
    54. self
    55. sessionStorage
    56. sharedStorage Experimental
    57. sidebar Non-standard Deprecated
    58. speechSynthesis
    59. status Deprecated
    60. statusbar
    61. toolbar
    62. top
    63. trustedTypes
    64. visualViewport
    65. window
  3. Instance methods
    1. alert()
    2. atob()
    3. back() Non-standard Deprecated
    4. blur() Deprecated
    5. btoa()
    6. cancelAnimationFrame()
    7. cancelIdleCallback()
    8. captureEvents() Deprecated
    9. clearImmediate() Non-standard Deprecated
    10. close()
    11. confirm()
    12. dump() Non-standard
    13. find() Non-standard
    14. focus()
    15. forward() Non-standard Deprecated
    16. getComputedStyle()
    17. getDefaultComputedStyle() Non-standard
    18. getScreenDetails() Experimental
    19. getSelection()
    20. matchMedia()
    21. moveBy()
    22. moveTo()
    23. open()
    24. postMessage()
    25. print()
    26. prompt()
    27. queryLocalFonts() Experimental
    28. releaseEvents() Deprecated
    29. requestAnimationFrame()
    30. requestFileSystem() Non-standard Deprecated
    31. requestIdleCallback()
    32. resizeBy()
    33. resizeTo()
    34. scroll()
    35. scrollBy()
    36. scrollByLines() Non-standard
    37. scrollByPages() Non-standard
    38. scrollTo()
    39. setImmediate() Non-standard Deprecated
    40. setResizable() Non-standard Deprecated
    41. showDirectoryPicker() Experimental
    42. showModalDialog() Non-standard Deprecated
    43. showOpenFilePicker() Experimental
    44. showSaveFilePicker() Experimental
    45. sizeToContent() Non-standard
    46. stop()
    47. updateCommands() Non-standard
    48. webkitConvertPointFromNodeToPage() Non-standard Deprecated
    49. webkitConvertPointFromPageToNode() Non-standard Deprecated
  4. Events
    1. afterprint
    2. appinstalled
    3. beforeinstallprompt
    4. beforeprint
    5. beforeunload
    6. blur
    7. copy
    8. cut
    9. devicemotion
    10. deviceorientation
    11. deviceorientationabsolute
    12. error
    13. focus
    14. gamepadconnected
    15. gamepaddisconnected
    16. hashchange
    17. languagechange
    18. load
    19. message
    20. messageerror
    21. offline
    22. online
    23. orientationchange Deprecated
    24. pagehide
    25. pagereveal Experimental
    26. pageshow
    27. pageswap Experimental
    28. paste
    29. popstate
    30. rejectionhandled
    31. resize
    32. storage
    33. unhandledrejection
    34. unload Deprecated
    35. vrdisplayactivate Non-standard Deprecated
    36. vrdisplayconnect Non-standard Deprecated
    37. vrdisplaydeactivate Non-standard Deprecated
    38. vrdisplaydisconnect Non-standard Deprecated
    39. vrdisplaypresentchange Non-standard Deprecated
  5. Inheritance
    1. EventTarget

目录

  • Value
  • Examples
  • Specifications
  • Browser compatibility

Window: length property

Returns the number of frames (either <frame> or <iframe> elements) in the window.

Value

A number.

Examples

js
if (window.length) {
  // this is a document with subframes
}

Specifications

Specification
HTML Standard
# dom-length-dev

Browser compatibility

BCD tables only load in the browser

MDN Web 中文网 - 粤ICP备13048890号