• 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

    • Accessibility

      Build web projects usable for all

    • Web Technology

      Web technology reference for developers

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

  • Plus
    • Overview

      A customized MDN experience

    • AI Help

      Get real-time assistance and support

    • Updates

      All browser compatibility updates at a glance

    • Documentation

      Learn how to use MDN Plus

    • FAQ

      Frequently asked questions about MDN Plus

  • Curriculum New
  • Blog
    • Playground

      Write, test and share your code

    • HTTP Observatory

      Scan a website for free

    • AI Help

      Get real-time assistance and support

  • Log in
  • Sign up for free
  1. 開発者向けのウェブ技術
  2. Web API
  3. Document
  4. close()
    • English (US)
    • Deutsch
    • Español
    • Português (do Brasil)
    • Русский
    • 中文 (简体)

このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。

この記事では

  • 構文
  • 例
  • 仕様書
  • ブラウザーの互換性
  1. ドキュメントオブジェクトモデル (DOM)
  2. Document
  3. コンストラクター
    1. Document()
  4. インスタンスプロパティ
    1. activeElement
    2. adoptedStyleSheets
    3. alinkColor 非推奨;
    4. all 非推奨;
    5. anchors 非推奨;
    6. applets 非推奨;
    7. bgColor 非推奨;
    8. body
    9. characterSet
    10. childElementCount
    11. children
    12. compatMode
    13. contentType
    14. cookie
    15. currentScript
    16. defaultView
    17. designMode
    18. dir
    19. doctype
    20. documentElement
    21. documentURI
    22. domain 非推奨;
    23. embeds
    24. featurePolicy Experimental
    25. fgColor 非推奨;
    26. firstElementChild
    27. fonts
    28. forms
    29. fragmentDirective
    30. fullscreen 非推奨;
    31. fullscreenElement
    32. fullscreenEnabled
    33. head
    34. hidden
    35. images
    36. implementation
    37. lastElementChild
    38. lastModified
    39. lastStyleSheetSet 非標準 非推奨;
    40. linkColor 非推奨;
    41. links
    42. location
    43. pictureInPictureElement
    44. pictureInPictureEnabled
    45. plugins
    46. pointerLockElement
    47. preferredStyleSheetSet 非標準 非推奨;
    48. prerendering Experimental
    49. readyState
    50. referrer
    51. rootElement 非推奨;
    52. scripts
    53. scrollingElement
    54. selectedStyleSheetSet 非標準 非推奨;
    55. styleSheets
    56. styleSheetSets 非標準 非推奨;
    57. timeline
    58. title
    59. URL
    60. visibilityState
    61. vlinkColor 非推奨;
    62. xmlEncoding 非推奨;
    63. xmlVersion 非推奨;
  5. 静的メソッド
    1. parseHTMLUnsafe()
  6. インスタンスメソッド
    1. adoptNode()
    2. append()
    3. browsingTopics() Experimental 非標準
    4. caretPositionFromPoint()
    5. caretRangeFromPoint() 非標準
    6. clear() 非推奨;
    7. close()
    8. createAttribute()
    9. createAttributeNS()
    10. createCDATASection()
    11. createComment()
    12. createDocumentFragment()
    13. createElement()
    14. createElementNS()
    15. createEvent() 非推奨;
    16. createExpression()
    17. createNodeIterator()
    18. createNSResolver() 非推奨;
    19. createProcessingInstruction()
    20. createRange()
    21. createTextNode()
    22. createTouch() 非標準 非推奨;
    23. createTouchList() 非標準 非推奨;
    24. createTreeWalker()
    25. elementFromPoint()
    26. elementsFromPoint()
    27. enableStyleSheetsForSet() 非標準 非推奨;
    28. evaluate()
    29. execCommand() 非推奨;
    30. exitFullscreen()
    31. exitPictureInPicture()
    32. exitPointerLock()
    33. getAnimations()
    34. getElementById()
    35. getElementsByClassName()
    36. getElementsByName()
    37. getElementsByTagName()
    38. getElementsByTagNameNS()
    39. getSelection()
    40. hasFocus()
    41. hasStorageAccess()
    42. hasUnpartitionedCookieAccess()
    43. importNode()
    44. moveBefore() Experimental
    45. mozSetImageElement() 非標準
    46. open()
    47. prepend()
    48. queryCommandEnabled() 非標準 非推奨;
    49. queryCommandState() 非標準 非推奨;
    50. queryCommandSupported() 非標準 非推奨;
    51. querySelector()
    52. querySelectorAll()
    53. releaseCapture() 非標準
    54. replaceChildren()
    55. requestStorageAccess()
    56. requestStorageAccessFor() Experimental
    57. startViewTransition()
    58. write() 非推奨;
    59. writeln()
  7. イベント
    1. afterscriptexecute 非標準 非推奨;
    2. beforescriptexecute 非標準 非推奨;
    3. DOMContentLoaded
    4. fullscreenchange
    5. fullscreenerror
    6. pointerlockchange
    7. pointerlockerror
    8. prerenderingchange Experimental
    9. readystatechange
    10. scroll
    11. scrollend
    12. scrollsnapchange Experimental
    13. scrollsnapchanging Experimental
    14. securitypolicyviolation
    15. selectionchange
    16. visibilitychange
  8. 継承
    1. Node
    2. EventTarget
  9. DOM に関連するページ
    1. AbortController
    2. AbortSignal
    3. AbstractRange
    4. Attr
    5. CDATASection
    6. CharacterData
    7. Comment
    8. CustomEvent
    9. DOMError 非推奨;
    10. DOMException
    11. DOMImplementation
    12. DOMParser
    13. DOMPoint
    14. DOMPointReadOnly
    15. DOMRect
    16. DOMTokenList
    17. DocumentFragment
    18. DocumentType
    19. Element
    20. Event
    21. EventTarget
    22. HTMLCollection
    23. MutationObserver
    24. MutationRecord
    25. NamedNodeMap
    26. Node
    27. NodeIterator
    28. NodeList
    29. ProcessingInstruction
    30. Range
    31. StaticRange
    32. Text
    33. TextDecoder
    34. TextEncoder
    35. TimeRanges
    36. TreeWalker
    37. XMLDocument

この記事では

  • 構文
  • 例
  • 仕様書
  • ブラウザーの互換性

Document: close() メソッド

Document.close() メソッドは、 Document.open() で開かれた文書への書き込みを終了します。

構文

js
close()

引数

なし。

返値

なし (undefined)。

例

js
// 書きこむ文書を開きます。
document.open();

// 文書の内容を書き込みます。
document.write("<p>たったひとつの内容。</p>");

// 文書を閉じます。
document.close();

仕様書

Specification
HTML
# dom-document-close-dev

ブラウザーの互換性

Help improve MDN

Learn how to contribute.

This page was last modified on 2024年6月19日 by MDN contributors.

View this page on GitHub • Report a problem with this content
MDN logo

Your blueprint for a better internet.

  • MDN on Bluesky
  • MDN on Mastodon
  • MDN on X (formerly Twitter)
  • MDN on GitHub
  • MDN Blog RSS Feed

MDN

  • About
  • 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
  • Hacks Blog
  • 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–2025 by individual mozilla.org contributors. Content available under a Creative Commons license.