Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Document or Window.open question

Status
Not open for further replies.

Grunty

Technical User
Joined
Jul 30, 2002
Messages
100
Location
GB
Being a newbie to javascript I thought I would find this easy but I am getting confused between Document.open and Window.open.

What I am trying to do is to Create a blank html page, write html code to it, then save it.

Would be gratefull for any pointers.

Ta
 
The "document" is what's IN the window.

Code:
var x = window.open("");
x.document.open();
x.document.write("<html><body>Hello, World!</body></html>");
x.document.close();

I think that'll do it.

Is that what you're after?

Dave


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
O Time, Strength, Cash, and Patience! [infinity]
 
Hi,

Hope this will help you

Code:
window.open("") //it to open blank window 
// write to the blank window need to open the document strem
// optional argument is mimeType and default is text/html
// ex:document.open("text/html");
document.open() //open document stream
document.write("<b>Some text</b>") // write some text document
document.close()// close the document ie., save the text

Cheers
Venu
 
Also, I just typed javascript document open into Google. The first link was very informative. I imagine javascript window open would be equally helpful.

Dave


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
O Time, Strength, Cash, and Patience! [infinity]
 
Thanks for the replies.

Having studied the code, I think I will be better off using vbscript or even vb. Eventually I want to expand the utility to include several other functions, none of which involve html documents.

Ta
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top