Click to See Complete Forum and Search --> : tables uing js


angel
11-24-2003, 07:16 PM
:confused:

i would i create a table using js for example a table with 5 columns and 10 rows. i know you need open da
js script tag

then use document.write with da html table tags inside brackets

the cols and rows need to be defined as a var then i get stuck!

please could someone help me

thanx

Gollum
11-25-2003, 02:16 AM
Ya do it a little somthin like dis...

<script type="text/javascript">
// place this script tag where you want the table drawn
function drawTable()
{
var i,j
document.write('<table border=1>');
for ( i = 0; i < 10; i++ )
{
document.write('<tr>');
for ( j = 0; j < 5; j++ )
{
document.write('<td>Cell ' + i + '.' + j + '</td>');
}
document.write('</tr>');
}
}

drawTable();

</script>