34,333
edits
Changes
→Writing Text to a docuemnt in a different Window
</pre>
=== Writing Text to a docuemnt document in a different Window ===
the writing of text to a document not restricted to writing to the document in the current window. It is also possible to write content to a different window simply by referencing the window in tyhe JavaScript command (for details on opening new windows see the [[JavaScript Window Object]] chapter).The following example opens a new window and then writes text into that new window: <pre> <html><head><title>JavaScript Document Object Example</title><script language="javascript" type="text/javascript"> function writeContent(content, windowObj){windowObj.document.write(content);}</script></head> <body> <script language="javascript" type="text/javascript">newWindowObj = window.open ("", "MyWindow");</script> <form action=""> <input type=button value="Write to New Window" onclick="writeContent('This is new content in the new window', newWindowObj)"/></form></body></html> </pre>
=== Changing the Document Title ===