...

View Full Version : Using rowspan in <td>



aiya
01-04-2004, 03:37 PM
Hi, i am trying to display different information in a table cell occupying the same table cell position (a_position). Within the abc.js script, I have the following to display the values in a table cell. However, it seems like each time,
I can only display one value per table cell, if I have more values occupying the same cell position, is it that i have to use rowspan to separate the information? Can anyone kindly advise?

<HTML>
<HEAD>
<script language='javascript' src='abc.js'>
</script>
<TITLE></TITLE></HEAD>
<BODY bgcolor=#498596 TEXT=#000000 LINK=##9932CC VLINK=#800080 onload = 'starttime_maxarray(830, 11)'>
</HTML>

//In javascript (abc.js)

function starttime_maxarray(starttime1, maxarraysize1)
{
starttime=starttime1;
maxarraysize=maxarraysize1;


for (i=0;i<6;i++) //initial the array to empty cell(table)
{
for (j=0;j<maxarraysize;j++)
{
a_position=maxarraysize*i+j;
all_classes[a_position]="&nbsp";
all_classes_index[a_position]="";
all_classes_wk[a_position] = "";
}
}
}

...
...
//store some values in all_classes[a_position]

var a_position=10;

all_classes[a_position] = E123(LT1)1;
all_classes[a_position] = E456(LT4)2;
...


for(i=0;i<6;i++)
{
for(j=0;j<maxarraysize;j++)
{

a_position = i * maxarraysize + j; //a_position = 65

if (all_classes[a_position].substring(0,1)!="&")
{

space=parseInt(all_classes[a_position].substring((all_classes[a_position].length-1),all_classes[a_position].length))
//space is to indicate the number of hours the lesson occupy

if (maxarraysize > 10) //for full-time subjects
writeln("<td rowspan=1 nowrap colspan="+space+">");

else
writeln("<td rowspan=1 nowrap colspan="+space+">");

writeln(all_classes[a_position].substring(0,(all_classes[a_position].length-1)));

writeln("</td>");
j=j+space-1;
}
else // (all_classes[a_position].substring(0,1)=="&")
{
if (maxarraysize < 10) //for part-time subjects
writeln("<td width=11% wrap>");
else
writeln("<td width=9% wrap>");

writeln("&nbsp");
writeln("</td>");
}
}
writeln("</tr>");
}
writeln("</table>")

Kor
01-05-2004, 02:33 PM
Hm... If you need to separate the values on vertical lines, maybe the simpliest way is to insert a break line each value

someting like

var value = value+'<br>';



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum