用TABLE怎样做? 如图
- 提问者网友:ミ烙印ゝ
- 2021-04-30 08:50
- 五星知识达人网友:像个废品
- 2021-04-30 09:14
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<script Language="javascript">
function a(x,y,color)
{document.write("<img border='0' +(x)+"; top: "+(y)+";background-color: "+color+"' src='px.gif' width=1 height=1>")}
</script>
<body leftmargin=0 topmargin=0> <br>
<br>
<br>
<br>
<br>
<TABLE border=0 bgcolor="000000" cellspacing="1" width=400>
<TR bgcolor="FFFFFF">
<TD width="111" height="52" ><table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td id="td1"></td>
<td>颜色</td>
</tr>
<tr>
<td >规格</td>
<td id="td2"></td>
</tr>
</table></TD>
<TD width="0"></TD>
</TR>
</TABLE>
<script>
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');
</script>
</BODY>
</HTML>
- 1楼网友:酒醒三更
- 2021-04-30 10:41
<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' +(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>