D. Alvarado wrote:
Hello,
Just wanted to check if this was possible. I have n blocks of text
and I would like each to pop up in a window. Hoever, I don't want to
create n different HTML pages and invoke each one through window.open.
Is there some way I can call window.open and pass the text to it and
have that text appear in the popup window? Styling is not important.
I don't care if the text just appears in plain font.
Thanks -
How about this approach? If you like this, you can make the window any
size, with or without scroll bars, and you can make it appear centered.
Once you get started post your code and you can get specific help for
any features you want to work on.
Mike
<html>
<title>CodeAve.com(JavaScript New Window within Previous Page)</title>
<body bgcolor="#FFFFFF">
<script language="JavaScript">
<!--
function open_new_window() {
new_window = open("","displayWindow","width=575,height=290,left =10,top=10");
// open new document
new_window.document.open();
// Text of the new document goes here
// Replace your " with ' or \" or your document.write statements will fail
new_window.document.write("<html>");
new_window.document.write("<head>");
new_window.document.write("<meta http-equiv='Content-Type'
content='text/html; charset=windows-1252'>");
new_window.document.write("<title>Table of Data</title>");
new_window.document.write("<style type='text/css'>");
new_window.document.write(" td { text-align: right; }");
new_window.document.write(" td.1 { text-align: left; }");
new_window.document.write("</style>");
new_window.document.write("</head>");
new_window.document.write("<body>");
new_window.document.write("<table border='1' cellspacing='1' width='555'
height='246' style='border-collapse: collapse'>");
new_window.document.write(" <tr>");
new_window.document.write(" <td class = '1' width='111'>Sonnenstand
in Grad über dem Horizont ein<br>Elevation of the sun (degrees above the
horizon</td>");
new_window.document.write(" <td class = '1' width='111'>Optimaler
Anstellwinkel des Spiegels °A<br>Optimal mirror orientation °A</td>");
new_window.document.write(" <td class = '1'
width='111'>Energieerzeugung Watts<br>Power output Watts</td>");
new_window.document.write(" <td class = '1' width='111'>Mit der
erzeugten Energie können Sie Grams<br>With the above displayed energy
you can heat Grams</td>");
new_window.document.write(" <td class = '1' width='111'>converted to
lbs:</td>");
new_window.document.write(" </tr>");
new_window.document.write(" <tr>");
new_window.document.write(" <td>0°</td>");
new_window.document.write(" <td>60°</td>");
new_window.document.write(" <td>138,56 W</td>");
new_window.document.write(" <td>552 g</td>");
new_window.document.write(" <td>1 lb 3.5 ozs</td>");
new_window.document.write(" </tr>");
new_window.document.write("</table>");
new_window.document.write("</body>");
new_window.document.write("</html>");
// close the document
new_window.document.close();
}
// -->
</script><a onclick="open_new_window()"
style="cursor:pointer;cursor:hand;" ><font color="#008080"><u>Open New
Window</u></font></a>
</body>
</html>