Multiple windows using window.open()

S

Sam

I have 2 jsp pages which are loaded from the same browser window.
Inside these jsp pages, I have created 2 windows to write client side
log. I have used different id for 2 windows as follow.

In JSP1 page I create one window & second window is created in jsp2
page.

Win1 = window.open('Log1', 'win1',
config='right=0,top=60,toolbar=0,width=300,height=300,resizable=1,scrollbars=1,location=no,status=no
');

Win1.document.writeln(yyyy + '-' + mm + '-' + dd + ' ' + hh + ':' + mn
+ ':' + ss + ',' + ms);

Win2 = window.open('Log2', 'win2',
config='right=0,top=60,toolbar=0,width=300,height=300,resizable=1,scrollbars=1,location=no,status=no
');

Win2.document.writeln(yyyy + '-' + mm + '-' + dd + ' ' + hh + ':' + mn
+ ':' + ss + ',' + ms);

When the page loads I can see 2 pop-up windows just fine. But then all
the writeln statements(from page1 & page2) go to the win2. Even the
writeln statements from page1. I would like to have page1 log go to
win1 & page2 go to win2. What I am doing wrong?
 
R

Randy Webb

Sam said the following on 3/23/2006 8:59 PM:
I have 2 jsp pages which are loaded from the same browser window.
Inside these jsp pages, I have created 2 windows to write client side
log. I have used different id for 2 windows as follow.

In JSP1 page I create one window & second window is created in jsp2
page.

Win1 = window.open('Log1', 'win1',
config='right=0,top=60,toolbar=0,width=300,height=300,resizable=1,scrollbars=1,location=no,status=no
');

Is Log1 the name of a file? If nothing else, it should be a blank file
that you can write to.
Win1.document.writeln(yyyy + '-' + mm + '-' + dd + ' ' + hh + ':' + mn
+ ':' + ss + ',' + ms);
Win2 = window.open('Log2', 'win2',
config='right=0,top=60,toolbar=0,width=300,height=300,resizable=1,scrollbars=1,location=no,status=no
');

Same here with Log2, the first parameter is the name of the file to open
in the new window.

Note: There is no config= in the third parameter to window.open, drop it:

window.open([resource],[windowName],[windowParameters]);
Win2.document.writeln(yyyy + '-' + mm + '-' + dd + ' ' + hh + ':' + mn
+ ':' + ss + ',' + ms);

Changing the Log1 and Log2 to about:blank I don't get the behavior you
describe.
When the page loads I can see 2 pop-up windows just fine. But then all
the writeln statements(from page1 & page2) go to the win2. Even the
writeln statements from page1. I would like to have page1 log go to
win1 & page2 go to win2. What I am doing wrong?

Use a dummy page (blank.html) to load instead of Log1 and Log2, or, make
them actual pages. Other than that, I can't duplicate what you are
describing.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,779
Messages
2,569,606
Members
45,239
Latest member
Alex Young

Latest Threads

Top