954,591 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Problem with window.open in Netscape7.2

I have a code to open new window and display a progress bar .The code works fine in I.E and Netscape4.7 but in Netscape 7.2 it opens a new window and displays nothing in it . Below is my code. Can you please tell me what is wrong in my code.

<html>
<script> 
var Window02; 
var secondWindow = false;
function ProgressBar(sLength) { 
var BarLength = 88; 
var iLength = parseFloat(sLength); 
var Bar = parseInt(iLength); 
var Trough = parseInt(BarLength - iLength); 
if (secondWindow == false) 
{ 
var theWindow = 'width=700,height=60,left=10,top=20,menubar=0,toolbar=0,location=0,personalbar=0,status=0,scrollbars =0,directories=0,resizable=0';
Window02 = window.open('', 'Wind02', theWindow); 
} 
if (secondWindow == false) 
{ 
Window02.document.write('<html><body><form name=f1>' + 
'<input type="text" size="' + Bar.toString() + '" style="background:blue">' +
'<input type="text" size="' + Trough.toString() + '" style="background:green">' +
'Page is loading.' +
'</form></body></html>');
secondWindow = true; 
Window02.document.close();
} 
if (secondWindow == true) 
{ 
Window02.document.write('<html><body><form name=f1>' + 
'<input type="text" size="' + Bar.toString() + '" style="background:blue">' +
'<input type="text" size="' + Trough.toString() + '" style="background:green">' +
'Page is loading.' +
'</form></body></html>');
Window02.document.close();
}
} 
function BarRun() 
{ 
for(i=0;i<50;i++)
{ 
ProgressBar(i);
BarDelay(1000); 
} 
Window02.close(); 
secondWindow = false; 
}
function BarDelay(msec) { 
var enter_date = new Date();
var enter_time = enter_date.getTime(); 
var leave_date = new Date(); 
var leave_time = leave_date.getTime(); // a big integer 
while (enter_time + msec > leave_time) { 
leave_date = new Date(); leave_time = leave_date.getTime(); } 
}
</script> 
<body> 
<form name=f1> 
<input type=button value=showProgressbar onClick=BarRun()>
</form>
</body>
</html>
muktidaniweb
Newbie Poster
11 posts since Jul 2005
Reputation Points: 10
Solved Threads: 0
 

See http://www.pageresource.com/jscript/jwinopen.htm
I believe the line that might interest you is: 'remove any whitespace for netscape'.

DaveSW
Master Poster
769 posts since Jul 2004
Reputation Points: 54
Solved Threads: 20
 

you need to use Window02.document.open() before there is a valid document to write to in netscape and mozilla.

alpha_foobar
Junior Poster
182 posts since May 2005
Reputation Points: 20
Solved Threads: 5
 

Thanks for your reply.
I added Window02.document.open() before Window02.document.write
but it doesn't help. If i remove the Window02.close() then I see that after sometime it displays the last position of the progress bar in the window. I read somewhere that this could be a multithreading issue and javascript doenot support multithreading.
Is there any other way a progressbar can be displayed ,it neednot be in a popup window?

muktidaniweb
Newbie Poster
11 posts since Jul 2005
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You