function a(x,y,color)
{document.write("")}
| 数学 | 英语 | C语言 | ||||
张三 | 55 | 66 | 77 | ||||
李四 | 99 | 68 | 71 | ||||
王五 | 33 | 44 | 55 |
function getTop(tdobj)
{
vParent = tdobj.offsetParent;
t = tdobj.offsetTop;
while (vParent.tagName.toUpperCase() != "BODY")
{
t += vParent.offsetTop;
vParent = vParent.offsetParent;
}
return t;
}
function getLeft(tdobj)
{
vParent = tdobj.offsetParent;
t = tdobj.offsetLeft;
while (vParent.tagName.toUpperCase() != "BODY")
{
t += vParent.offsetLeft;
vParent = vParent.offsetParent;
}
return t;
}
function line(x1,y1,x2,y2,color)
{
var tmp
if(x1>=x2)
{
tmp=x1;
x1=x2;
x2=tmp;
tmp=y1;
y1=y2;
y2=tmp;
}
for(var i=x1;i<=x2;i++)
{
x = i;
y = (y2 - y1) / (x2 - x1) * (x - x1) + y1;
a(x,y,color);
}
}
//line(1,1,100,100,"000000");
line(getLeft(td1),getTop(td1),getLeft(td1)+td1.offsetWidth,getTop(td1)+td1.offsetHeight,'#000000');
line(getLeft(td2),getTop(td2),getLeft(td2)+td2.offsetWidth,getTop(td2)+td2.offsetHeight,'#000000');