- 表格斜线的实现,实现表格表头的斜线,基于JavaScript技术实现,比较新颖,可以用来作课程表及统计表格等,效果不错。
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>石家庄水泵厂</title> </head> <script Language="javascript"> function a(x,y,color) {document.write("<img border=‘0‘ style=‘position: absolute; left: "+(x+18)+"; top: "+(y+18)+";background-color: "+color+"‘ src=‘px.gif‘ width=1 height=1>")} </script> <body leftmargin=18 topmargin=18> <TABLE border=0 bgcolor="000000" cellspacing="1" width=398> <TR bgcolor="FFFFFF"> <TD id="td1"> </TD> <TD>阿Q</TD> <TD>张四</TD> </TR> <TR bgcolor="FFFFFF"> <TD>软件理论</TD> <TD>72</TD> <TD>36</TD> </TR> <TR bgcolor="FFFFFF"> <TD>计算机</TD> <TD>85</TD> <TD>58</TD> </TR> </TABLE> <script> 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(td1.offsetLeft,td1.offsetTop,td1.offsetLeft+td1.offsetWidth,td1.offsetTop+td1.offsetHeight,‘#000000‘) </script> </BODY> </html>
表格斜线的实现方法
时间: 2024-11-08 15:30:40