faqts : Computers : Programming : Languages : JavaScript : Tables

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

144 of 174 people (83%) answered Yes
Recently 5 of 10 people (50%) answered Yes

Entry

How do I get a scrollable TABLE?

Apr 14th, 2000 16:00
Martin Honnen,


With IE4+ and NN6 you can stuff your TABLE into a DIV with dimensions 
set with css and additionally the css property
  overflow: auto; /* scrollbars when necessary */
or
  overflow: scroll; /* scrollbars always */
Example:

<HTML>
<HEAD>
<STYLE>
.js {
  color: white;
  background-color: orange;
}
</STYLE>
<SCRIPT>
</SCRIPT>
</HEAD>
<BODY>
<DIV STYLE="width: 200px; height: 100px;
            overflow: auto;"
>
<TABLE BORDER="1">
<SCRIPT>
for (var i = 0; i < 40; i++)
  document.write('<TR><TD CLASS="js">' + i + 
                 ': JavaScript.FAQTs.com<\/TD><\/TR>');
</SCRIPT>
</TABLE>
</DIV>
</BODY>
</HTML>