Document.write():

()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 AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
writeChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 4Opera Full support 3Safari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support 10.1Safari iOS Full support 1Samsung Internet Android Full support 1.0

Legend

Full support  
Full support

ראה גם