views:

46

answers:

4

How would I open a new window in JavaScript and insert HTML data instead of just linking to an HTML file?

+1  A: 

Here is some info that should be useful:
http://www.codetoad.com/forum/15_27898.asp

Henrik Söderlund
+2  A: 

You can use window.open to open a new window/tab(according to browser setting) in javascript.

By using document.write you can write HTML content to the opened window.

rahul
A: 

you should give ThickBox a try. This doesn't open a new browserwindow, but creates an overlay on your page that looks like a popup.

Natrium
A: 

When you create a new window using open, it returns a reference to the new window, you can use that reference to write to the newly opened window via its document object.

Here is an example:

var newWin = open('url','newName','height=300;width:300');
newWin.document.write('html to write...');
Oded