I have an internet application which has a progress bar show whenever
the customer is requesting data from the server. This progress bar is
coded to work in both Netscape 4.75 and above and IE 5.0 and above.
The progress bar code is written in javascript in an external js file
(progressbar.js ). The web screen is in a seperate jsp file
(Registration.j sp). The problem I'm having is that the progress bar is
not showing in Netscape 4.75 on a MAC. I think it may have something
to do with DIV located in the jsp file because if I comment the DIV,
the progress bar shows up. I am using DIVs because when the form
loads, the "divReservation Input" is visible and the "divMessage " is
hidden. Then, when I call the progressbar.js, the "divMessage " is
visible and the "divReservation Input" is hidden. I need help on
properly coding this. Here is my code:
The progress bar code is in an external js file (progressbar.js - code
below):
------------------------------------------------------------------------------
var NS4 = (document.layer s) ? true : false;
var IE = (document.all) ? true : false;
var blocksize = (barwidth-2)/waitTime/10;
var loaded = 0;
var ProgBar_outer;
var ProgBar_done;
var PBbckgnd;
var Pid = 0;
if(NS4)
{
document.write( '<ilayer name="ProgBar_o uter" id="ProgBar_out er"
visibility="hid e" height="'+barhe ight+'" width="'+barwid th+'"
onmouseup="hide bar()">');
document.write( '<layer width="'+barwid th+'" height="'+barhe ight+'"
bgcolor="'+bord ercolor+'" top="0" left="0"></layer>');
document.write( '<layer width="'+(barwi dth-2)+'"
height="'+(barh eight-2)+'" bgcolor="'+unlo adedcolor+'" top="1"
left="1"></layer>');
document.write( '<layer name="ProgBar_d one" id="ProgBar_don e"
width="'+(barwi dth-2)+'" height="'+(barh eight-2)+'"
bgcolor="'+load edcolor+'" top="1" left="1"></layer>');
document.write( '</ilayer>');
}
else
{
document.write( '<div id="ProgBar_out er" onmouseup="hide bar()"
style="position :relative; visibility:hidd en;
background-color:'+borderc olor+'; width:'+barwidt h+'px;
height:'+barhei ght+'px;">');
document.write( '<div style="position :absolute; top:1px; left:1px;
width:'+(barwid th-2)+'px; height:'+(barhe ight-2)+'px;
background-color:'+unloade dcolor+'; font-size:1px;"></div>');
document.write( '<div id="ProgBar_don e" style="position :absolute;
top:1px; left:1px; width:0px; height:'+(barhe ight-2)+'px;
background-color:'+loadedc olor+'; font-size:1px;"></div>');
document.write( '</div>');
}
function progressBarInit ()
{
ProgBar_outer=( NS4)?findlayer( 'ProgBar_outer' ):(IE)?document .all['ProgBar_outer']:document.getEl ementById('Prog Bar_outer');
ProgBar_done=(N S4)?ProgBar_out er.document.lay ers['ProgBar_done']:(IE)?document. all['ProgBar_done']:document.getEl ementById('Prog Bar_done');
resizeElement(P rogBar_done,0,0 ,barheight-2,0);
if(NS4)
{
ProgBar_outer.v isibility = "show";
Pid = setInterval('in crCount()',95);
}
else
{
ProgBar_outer.s tyle.visibility = "visible";
Pid = setInterval('in crCount()',95);
}
}
function findlayer(name)
{
var i;
for(i=0; i<document.laye rs.length; i++)
{
if(document.lay ers[i].name == name)
{return(documen t.layers[i]);}
if(document.lay ers[i].document.layer s.length > 0)
{if((document.l ayers[i] = findlayer(name) ) != null)
{return(documen t.layers[i]);}}
}
return null;
}
function resizeElement(i d,top,right,bot tom,left)
{
if(NS4)
{
id.clip.left = left;
id.clip.top = top;
id.clip.right = right;
id.clip.bottom = bottom;
}
else
{id.style.width = right + 'px'; }
}
function incrCount()
{
loaded++;
if(loaded < 0)
{loaded=0;}
if(loaded >= waitTime*10)
{
clearInterval(P id);
loaded = waitTime*10;
setTimeout('hid ebar()',100);
}
resizeElement(P rogBar_done,0,b locksize*loaded ,barheight-2,0);
}
function hidebar()
{
clearInterval(P id);
loaded=0;
Pid = setInterval('in crCount()',95);
}
Registration.js p (code below):
------------------------------
<HEAD>
<title>Registra tion</title>
<SCRIPT language="JavaS cript">
<!--#include virtual="progre ssbar.js"-->
var browserName = navigator.appNa me;
var NS4 = (document.layer s) ? true : false;
function submitForm()
{
showWaitMessage ();
document.frmAdv ancedGuestRegis tration.submit( );
}
function showWaitMessage ()
{
if(NS4)
{
document.layers['divReservation Input'].visibility = 'hide';
document.layers['divMessage'].visibility = 'show';
}
else
{
document.getEle mentById("divRe servationInput" ).style.visibil ity =
"hidden";
document.getEle mentById("divMe ssage").style.v isibility = "visible";
}
progressBarInit ();
}
</SCRIPT>
</HEAD>
<BODY bgcolor=3366cc>
<jsp:useBean id="Reservation View" scope="session"
class="com.view .ReservationInp utView"></jsp:useBean>
<div id="divReservat ionInput"
style="visibili ty:visible;posi tion:absolute;t op:16px;width:1 00%">
<table width=650 border=0 cellpadding=0 cellspacing=0 align="center">
<tr>
<td colspan=4 bgcolor=#FFFFFF ><img src="images/arch_left.gif"
width=182 height=26></td>
<td width=31 height=26 bgcolor=#FFFFFF ><img
src="images/spacer.gif"></td>
<td colspan=4 bgcolor=#FFFFFF ><div align="right">< img
src="images/arch_right.gif" width=271 height=26></div></td>
</tr>
<tr>
<td width=166 height=291 bgcolor=#FFCC00 valign="top"><i mg
src="images/spacer.gif"></td>
<td width=484 height=291 colspan=9 valign="top"
bgcolor="#FFFFF F"><br>
<table width="95%" border="0" cellspacing="0" cellpadding="0"
align="center">
<tr>
<td>
<p><font face="Verdana, Arial, Helvetica, sans-serif"
size="1">Please provide the following information to verify
registration status.</font></p>
<FORM name="frmRegist ration" method="POST" action="Servlet ">
<table width="90%" border="0" cellspacing="0" cellpadding="2" >
<tr>
<td width="25%" height="20"><b> <font face="Verdana, Arial,
Helvetica, sans-serif" size="1" color="3366CC"> Reservation
Number</font></b></td>
<td colspan="2" height="20"><in put type="text" name="txtResNbr "
value="<%=Reser vationView.getR eservation().ge tReservationNum ber()%>"></td>
</tr>
<tr>
<td width="25%" height="20">&nb sp;</td>
<td width="27%" height="20" align="center"> <a
href="javascrip t:checkForm()"> <img src="images/submit.gif" width="72"
height="20" border="0"></a></td>
<td width="38%" height="20">&nb sp;</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<div id="divMessage "
style="visibili ty:hidden;posit ion:absolute;to p:16px;width:10 0%">
<table width=650 border=0 cellpadding=0 cellspacing=0 align="center">
<tr>
<td colspan=9 bgcolor=#FFFFFF ><img src="images/tit_grf.gif" width=484
height=20></td>
</tr>
<tr>
<td width=166 height=291 bgcolor=#FFCC00 valign="top></td>
<td width=484 height=291 colspan=9 valign="top"
bgcolor="#FFFFF F"><br><br><br> <br><br>
<FORM name="form1" method="POST" action="Servlet ">
<table width="95%" border="0" cellspacing="0" cellpadding="0"
align="center">
<tr>
<td align="center" height="30"><fo nt face="verdana" color="3366cc"
size="2"><b>Sea rching For Your Reservation - Please
Wait...</b></font></td>
</tr>
<tr>
<td>
<table align="center">
<tr>
<td><SCRIPT language="javas cript"
src="./progressbar.js" ></SCRIPT></td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</div>
<INPUT type="hidden" name="hdnNextPa ge"
value="Advanced GuestRegistrati onSummary">
<INPUT type="hidden" name="hdnAction "
value="Retrieve RegistrationSum mary">
</BODY>
</HTML>
the customer is requesting data from the server. This progress bar is
coded to work in both Netscape 4.75 and above and IE 5.0 and above.
The progress bar code is written in javascript in an external js file
(progressbar.js ). The web screen is in a seperate jsp file
(Registration.j sp). The problem I'm having is that the progress bar is
not showing in Netscape 4.75 on a MAC. I think it may have something
to do with DIV located in the jsp file because if I comment the DIV,
the progress bar shows up. I am using DIVs because when the form
loads, the "divReservation Input" is visible and the "divMessage " is
hidden. Then, when I call the progressbar.js, the "divMessage " is
visible and the "divReservation Input" is hidden. I need help on
properly coding this. Here is my code:
The progress bar code is in an external js file (progressbar.js - code
below):
------------------------------------------------------------------------------
var NS4 = (document.layer s) ? true : false;
var IE = (document.all) ? true : false;
var blocksize = (barwidth-2)/waitTime/10;
var loaded = 0;
var ProgBar_outer;
var ProgBar_done;
var PBbckgnd;
var Pid = 0;
if(NS4)
{
document.write( '<ilayer name="ProgBar_o uter" id="ProgBar_out er"
visibility="hid e" height="'+barhe ight+'" width="'+barwid th+'"
onmouseup="hide bar()">');
document.write( '<layer width="'+barwid th+'" height="'+barhe ight+'"
bgcolor="'+bord ercolor+'" top="0" left="0"></layer>');
document.write( '<layer width="'+(barwi dth-2)+'"
height="'+(barh eight-2)+'" bgcolor="'+unlo adedcolor+'" top="1"
left="1"></layer>');
document.write( '<layer name="ProgBar_d one" id="ProgBar_don e"
width="'+(barwi dth-2)+'" height="'+(barh eight-2)+'"
bgcolor="'+load edcolor+'" top="1" left="1"></layer>');
document.write( '</ilayer>');
}
else
{
document.write( '<div id="ProgBar_out er" onmouseup="hide bar()"
style="position :relative; visibility:hidd en;
background-color:'+borderc olor+'; width:'+barwidt h+'px;
height:'+barhei ght+'px;">');
document.write( '<div style="position :absolute; top:1px; left:1px;
width:'+(barwid th-2)+'px; height:'+(barhe ight-2)+'px;
background-color:'+unloade dcolor+'; font-size:1px;"></div>');
document.write( '<div id="ProgBar_don e" style="position :absolute;
top:1px; left:1px; width:0px; height:'+(barhe ight-2)+'px;
background-color:'+loadedc olor+'; font-size:1px;"></div>');
document.write( '</div>');
}
function progressBarInit ()
{
ProgBar_outer=( NS4)?findlayer( 'ProgBar_outer' ):(IE)?document .all['ProgBar_outer']:document.getEl ementById('Prog Bar_outer');
ProgBar_done=(N S4)?ProgBar_out er.document.lay ers['ProgBar_done']:(IE)?document. all['ProgBar_done']:document.getEl ementById('Prog Bar_done');
resizeElement(P rogBar_done,0,0 ,barheight-2,0);
if(NS4)
{
ProgBar_outer.v isibility = "show";
Pid = setInterval('in crCount()',95);
}
else
{
ProgBar_outer.s tyle.visibility = "visible";
Pid = setInterval('in crCount()',95);
}
}
function findlayer(name)
{
var i;
for(i=0; i<document.laye rs.length; i++)
{
if(document.lay ers[i].name == name)
{return(documen t.layers[i]);}
if(document.lay ers[i].document.layer s.length > 0)
{if((document.l ayers[i] = findlayer(name) ) != null)
{return(documen t.layers[i]);}}
}
return null;
}
function resizeElement(i d,top,right,bot tom,left)
{
if(NS4)
{
id.clip.left = left;
id.clip.top = top;
id.clip.right = right;
id.clip.bottom = bottom;
}
else
{id.style.width = right + 'px'; }
}
function incrCount()
{
loaded++;
if(loaded < 0)
{loaded=0;}
if(loaded >= waitTime*10)
{
clearInterval(P id);
loaded = waitTime*10;
setTimeout('hid ebar()',100);
}
resizeElement(P rogBar_done,0,b locksize*loaded ,barheight-2,0);
}
function hidebar()
{
clearInterval(P id);
loaded=0;
Pid = setInterval('in crCount()',95);
}
Registration.js p (code below):
------------------------------
<HEAD>
<title>Registra tion</title>
<SCRIPT language="JavaS cript">
<!--#include virtual="progre ssbar.js"-->
var browserName = navigator.appNa me;
var NS4 = (document.layer s) ? true : false;
function submitForm()
{
showWaitMessage ();
document.frmAdv ancedGuestRegis tration.submit( );
}
function showWaitMessage ()
{
if(NS4)
{
document.layers['divReservation Input'].visibility = 'hide';
document.layers['divMessage'].visibility = 'show';
}
else
{
document.getEle mentById("divRe servationInput" ).style.visibil ity =
"hidden";
document.getEle mentById("divMe ssage").style.v isibility = "visible";
}
progressBarInit ();
}
</SCRIPT>
</HEAD>
<BODY bgcolor=3366cc>
<jsp:useBean id="Reservation View" scope="session"
class="com.view .ReservationInp utView"></jsp:useBean>
<div id="divReservat ionInput"
style="visibili ty:visible;posi tion:absolute;t op:16px;width:1 00%">
<table width=650 border=0 cellpadding=0 cellspacing=0 align="center">
<tr>
<td colspan=4 bgcolor=#FFFFFF ><img src="images/arch_left.gif"
width=182 height=26></td>
<td width=31 height=26 bgcolor=#FFFFFF ><img
src="images/spacer.gif"></td>
<td colspan=4 bgcolor=#FFFFFF ><div align="right">< img
src="images/arch_right.gif" width=271 height=26></div></td>
</tr>
<tr>
<td width=166 height=291 bgcolor=#FFCC00 valign="top"><i mg
src="images/spacer.gif"></td>
<td width=484 height=291 colspan=9 valign="top"
bgcolor="#FFFFF F"><br>
<table width="95%" border="0" cellspacing="0" cellpadding="0"
align="center">
<tr>
<td>
<p><font face="Verdana, Arial, Helvetica, sans-serif"
size="1">Please provide the following information to verify
registration status.</font></p>
<FORM name="frmRegist ration" method="POST" action="Servlet ">
<table width="90%" border="0" cellspacing="0" cellpadding="2" >
<tr>
<td width="25%" height="20"><b> <font face="Verdana, Arial,
Helvetica, sans-serif" size="1" color="3366CC"> Reservation
Number</font></b></td>
<td colspan="2" height="20"><in put type="text" name="txtResNbr "
value="<%=Reser vationView.getR eservation().ge tReservationNum ber()%>"></td>
</tr>
<tr>
<td width="25%" height="20">&nb sp;</td>
<td width="27%" height="20" align="center"> <a
href="javascrip t:checkForm()"> <img src="images/submit.gif" width="72"
height="20" border="0"></a></td>
<td width="38%" height="20">&nb sp;</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<div id="divMessage "
style="visibili ty:hidden;posit ion:absolute;to p:16px;width:10 0%">
<table width=650 border=0 cellpadding=0 cellspacing=0 align="center">
<tr>
<td colspan=9 bgcolor=#FFFFFF ><img src="images/tit_grf.gif" width=484
height=20></td>
</tr>
<tr>
<td width=166 height=291 bgcolor=#FFCC00 valign="top></td>
<td width=484 height=291 colspan=9 valign="top"
bgcolor="#FFFFF F"><br><br><br> <br><br>
<FORM name="form1" method="POST" action="Servlet ">
<table width="95%" border="0" cellspacing="0" cellpadding="0"
align="center">
<tr>
<td align="center" height="30"><fo nt face="verdana" color="3366cc"
size="2"><b>Sea rching For Your Reservation - Please
Wait...</b></font></td>
</tr>
<tr>
<td>
<table align="center">
<tr>
<td><SCRIPT language="javas cript"
src="./progressbar.js" ></SCRIPT></td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</div>
<INPUT type="hidden" name="hdnNextPa ge"
value="Advanced GuestRegistrati onSummary">
<INPUT type="hidden" name="hdnAction "
value="Retrieve RegistrationSum mary">
</BODY>
</HTML>
Comment