Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 19th, 2004, 10:22 PM
Friend of Wrox
 
Join Date: Nov 2003
Location: , , .
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default write() without clearing old document

My page opens a new window with existing data, and I want to add to the page without clearing out the old document. Is this possible? I have tried (assuming newwin is my new window)

newwin.document.write("blahblah")

and

newwin.document.close();
newwin.document.write("blahblah");

but both clear out the new page to put the new data. Please help!

Thanks,

Snib

__________________
-Snib - http://www.snibworks.com
Where will you be in 100 years?
Reply With Quote
  #2 (permalink)  
Old January 20th, 2004, 05:12 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

If you don't want to use textboxes then have a div in the page with the id 'divMessage' then a function such as:
Code:
function showMessage(Html, Append)
{
  var oDiv = document.getElementById("divMessage");
  if (Append)
  {
   oDiv.innerHTML += Html;
  }
  else
  {
    oDiv.innerHTML = Html;
  }
}
to call use:
Code:
showMessage("<b>Hello</b>");
to clear the display and show an enboldened 'Hello', use:
Code:
showMessage("<i>World</i>", true);
to add an italicised 'World'.

--

Joe
Reply With Quote
  #3 (permalink)  
Old January 20th, 2004, 06:27 PM
Friend of Wrox
 
Join Date: Nov 2003
Location: , , .
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Joe,

Thanks, I didn't think of that!

However, is there a way to do this into, say, text files? I assume not...

Thanks,

Snib

Reply With Quote
  #4 (permalink)  
Old January 21st, 2004, 05:01 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Not unless client security levels are set to a very low level in the relevant zone. If they are, either a company intranet or the like, then use the FileSystemObject on Windows machines. Plenty of examples on the web.

--

Joe
Reply With Quote
  #5 (permalink)  
Old January 21st, 2004, 04:28 PM
Friend of Wrox
 
Join Date: Nov 2003
Location: , , .
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Thanks, Joe.

Snib

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Write a XML Document using java. vinitpugaliya XML 0 January 8th, 2007 06:26 AM
Document.write hussainm Javascript How-To 2 July 12th, 2006 05:20 AM
Write Nested XML document into SQL Server tables boondocksaint20 VB.NET 0 May 2nd, 2006 12:35 PM
document.write into cell or td with Opera crmpicco Javascript How-To 0 April 11th, 2006 04:58 AM
Write a document to the server Hal Emmerich Javascript How-To 1 November 13th, 2004 07:15 AM



All times are GMT -4. The time now is 04:42 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.