[thelist] missing scrollbar on Netscape 4.x browsers when writing to a div

Emily Liang Emily.Liang at morganstanley.com
Wed Jan 9 16:25:16 CST 2002



I am having some javascript problems with the following code using
Netscape 4.x browsers.

I call the writeUserList function to populate the div area with user
information, one user per line.  There are many rows, so it should show
a scrollbar once finish writing in the div.  This worked in IE.  In
Netscape 4.x, the scrollbar did not appear.  If I did a resize, the
scrollbar appeared, but some users in the div area lost the stylesheet
so they didn't look consistent.  How do I force the scrollbar to appear
for Netscape 4.x browsers in this case?  Any suggestions appreciated. 
Thanks!!!

        <div id="usertable" style="position:absolute">
        <table width="100%" border="0" cellspacing="0" cellpadding="0"
bgcolor="#FFFFFF">
        </table>
        </div>

var _headerHtml = "<table width='100%'
border='0'cellspacing='0'cellpadding='0' bgcolor='#FFFFFF'>";

_headerHtml += "<tr><td width='2%'></td><td width='30%'></td><td
width='2%'></td><td width='22%'></td><td
width='2%'></td><tdwidth='40%'><td width='2%'></td></tr>";

var _footerHtml = "</table>";
var _ns4 = (document.layers) ? true : false;

function writeUserList()
{
     var i=0;
     var newHtml = "";
     var a=_aliasees[0];
     var bg1 = "#CCCC99";
     var bg2 = "#FFFFCC";
     var bg = "";

     for ( i = 0; i < _aliasees.length; i++) {
        a = _aliasees[i];
        if ( i == 0 || i % 2 == 0 ) {
                bg = bg2;
        } else {
                bg = bg1;
        }
        newHtml += "<tr><td>&nbsp;</td><td class=jpapplink bgcolor='"
+bg + "'><a href='javascript: goAlias(\"" + a.login + "\")'</a>" +
a.login +"</td><td>&nbsp;</td><td class=alias bgcolor='" + bg + "'>" +
a.name +"</td><td>&nbsp;</td><td class=alias  bgcolor='" + bg + "'>" +
a.company+"</td><td>&nbsp;</td></tr>";
     }

     newHtml = _headerHtml + newHtml + _footerHtml;

     if (_ns4) {
        document.usertable.document.open();
        document.usertable.document.write(newHtml);
        document.usertable.document.close();
     }
     else {
        var usertable = getElement("usertable");
        usertable.innerHTML = newHtml;
     }

     return;

}

        }




More information about the thelist mailing list