I have a script( more of a web app) which generates a customized table element. I want the user to be able to "save" this table. Thus far , what I am doing is getting the HTML of the table and displaying in a textarea for the user to cut and paste to a text editor. This is fine, except , I worry MANY in my target audience wont know how to use a text editor, or make plain text, or save as HTML.. etc.

So I was hoping to use .js to open a new window and write in the HTML so that the users could merely do a FILE>SAVE PAGE AS directly from their browsers.

I suppose I have two questions:

1) how do I document.write to a NEW window??

2) I have noticed that when you use.js to generate HTML, it doesnt show in the view source , thus it wont "save as" anything else but a BLANK doc, and I was hoping someone could advice me as to how to make generated HTML "visible" so that it can be saved.

Maybe I am going about the this the wrong way.. so any advice is appreciated.