()Document.write - כותב מחרוזת טקסט אל גוף מסמך HTML.

תחביר

document.write(markup);

פרמטרים

markup
מחרוזת המכילה את הטקסט שיופיע במסמך.

דוגמה

<html>

<head>
  <title>write example</title>

  <script>
    function newContent() {
      alert("load new content");
      document.open();
      document.write("<h1>Out with the old - in with the new!</h1>");
      document.close();
    }
  </script>
</head>

<body onload="newContent();">
  <p>Some original document content.</p>
</body>

</html>

מפרט

Specification Status Comment
HTML Living Standard
The definition of 'document.write(...)' in that specification.
Living Standard  
Document Object Model (DOM) Level 2 HTML Specification
The definition of 'document.write(...)' in that specification.
Obsolete  

תאימות דפדפן

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
writeChrome Full support 45
Notes
Full support 45
Notes
Notes Before Chrome 64, this method was accessed through the HTMLDocument alias.
Edge Full support 12Firefox Full support YesIE ? Opera ? Safari ? WebView Android Full support 45
Notes
Full support 45
Notes
Notes Before Chrome 64, this method was accessed through the HTMLDocument alias.
Chrome Android Full support 45
Notes
Full support 45
Notes
Notes Before Chrome 64, this method was accessed through the HTMLDocument alias.
Edge Mobile ? Firefox Android Full support YesOpera Android ? Safari iOS ? Samsung Internet Android ?

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown
See implementation notes.
See implementation notes.

ראה גם

Document Tags and Contributors

Contributors to this page: mdnwebdocs-bot, fabio.rahamim
Last updated by: mdnwebdocs-bot,