您现在的位置: 中国维修网 >> 新闻中心 >> 维修技术 >> 电脑维修 >> 文章正文
 一些表格的经典代码
作者:佚名    文章来源:本站原创    点击数:    更新时间:1/11/2007

三种细线表格做法
<table width="100%" border="1" bordercolor="#000000">
  <tr bordercolor="#FFFFFF">
    <td>表格边线为1,线色为黑,行线色为白。</td>
  </tr>
</table>
<p>
<table width="100%" border="0" cellspacing="1" bgcolor="#000000">
  <tr>
    <td bgcolor="#FFFFFF">表格边线为0,间距为1,背景色为黑,行背景色为白。</td>
  </tr>
</table>
<table style="border-collapse:collapse;" border="1">
  <tr>
    <td bgcolor="#FFFFFF">style="border-collapse:collapse;" </td>
  </tr>
</table>

立体表格

<table  border=1 cellspacing=0  width=100% bordercolorlight=#333333 bordercolordark=#efefef>
<tr bgcolor=#cccccc>
<td>nxyc163</td>
<td>nxyc163</td>
<td>nxyc163</td>
<td>nxyc163</td>
</tr>
<tr bgcolor=#cccccc>
<td>nxyc163</td>
<td>nxyc163</td>
<td>nxyc163</td>
<td>cnxyc163</td>
</tr>
</table>
<center>表格边线为1,间隔为0,左上为#333333,右下为#efefef,行背景色为#cccccc

表格的边框不断在闪

<table border="0" width="280" id="myexample" style="border:1px solid red">
<tr>
<td>nxyc163 nxyc163 nxyc163 nxyc163 nxyc163 nxyc163</td>
</tr>
</table>
<script language="JavaScript1.2">
<!--
function flashit(){
if (!document.all)
return
if (myexample.style.borderColor=="blue")
myexample.style.borderColor="red"
else
myexample.style.borderColor="blue"
}
setInterval("flashit()", 500)
//-->
</script>

不用嵌套制作同一行放两个表格

<table border=1 align=left>
<tr>
<td>nxyc163</td>
</tr>
</table>
<table border=1 align="right">
<tr>
<td>nxyc163.com</td>
</tr>
</table>


<br><br><br>


<table border=1 align=left>
<tr>
<td>nxyc163</td>
</tr>
</table>
<table border=1 align="center">
<tr>
<td>nxyc163.com</td>
</tr>
</table>


<br><br><br>


<table border="1" align="left" width="50%" height="100px">
<tr>
<td>nxyc163</td>
</tr>
</table>
<table border="1" align="right" width="50%">
<tr>
<td>nxyc163.com</td>
</tr>
</table>


<br><br><br><br><br><br>


<table border=1 align=left>
<tr>
<td>nxyc163</td>
</tr>
</table>
<table border=1>
<td>nxyc163.com</td>
</tr>
</table>

虚线边框表格

<style type="text/css">
.tb{BORDER: #000000 1px dotted;}
</style>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td class="tb"><center>www.nxyc163.com</td>
  </tr>
</table>
<p>
虚线直线1
<hr size=1 style="border:1px dotted #001403;">
虚线直线2
<p size=1 style="border:1px dotted #001403;">

表格行换色
a,效果达到了,但应用不大。

<table  width=500>
<script>
for(i=0;i<10;i++){
i%2==1?document.write('<tr><td align=center bgcolor=#cccccc>'+i+'</td></tr>'):document.write('<tr><td align=center bgcolor=#efefef>'+i+'</td></tr>');
}
</script>
</table>

b,利用脚本来控制

<SCRIPT LANGUAGE="JavaScript">
window.onload = function() {
doubleBgColor(document.getElementById("table1"),"#cecece","#ececec")
}

function doubleBgColor(Table,Bg1,Bg2) {
for (var i=0;i<Table.rows.length;i++) Table.rows[i].bgColor=i%2?Bg2:Bg1;
}
</SCRIPT>
<TABLE border=0 cellpadding=1 cellspacing=1 id="table1" width="500">
<TR><TD>&nbsp;</TD></TR>
<TR><TD>&nbsp;</TD></TR>
<TR><TD>&nbsp;</TD></TR>
<TR><TD>&nbsp;</TD></TR>
<TR><TD>&nbsp;</TD></TR>
<TR><TD>&nbsp;</TD></TR>
<TR><TD>&nbsp;</TD></TR>
<TR><TD>&nbsp;</TD></TR>
<TR><TD>&nbsp;</TD></TR>
<TR><TD>&nbsp;</TD></TR>
<TR><TD>&nbsp;</TD></TR>
<TR><TD>&nbsp;</TD></TR>
</TABLE>

c,表格和控制分开,只需要指定表格 id 即可

<script defer>
for(i=0;i<oTable.rows.length;i++){
if(i%2==0){
oTable.rows[i].bgColor="#cccccc";
}else{
oTable.rows[i].bgColor="#efefef";
}
}
</script>

<table width=100 height=100  ID="oTable">
<tr>
<td></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td></td>
</tr>
</table>

d,做成了样式表

<style>
#oTable tr {alternateColor:expression(bgColor=rowIndex%2==0?'#cccccc':'#efefef')}
</style>
<table width=500 height=100 border=1 ID="oTable">
<tr>
<td></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td></td>
</tr>
</table>

表格边框显示外阴影


<table  align=center  width=200  height=100  bgcolor=#f3f3f3 style="filter:progid:DXImageTransform.Microsoft.Shadow(Color=#333333,Direction=120,strength=5)">
<tr>
<td><center>www.nxyc163.com</td>
</tr>
</table>

透明表格

<table bgcolor=#ececec style="filter:alpha(opacity=50)" width=200 height=100 border=0>
<tr><td><center>nxyc163</td></

 维客  维客聊天  和境山庄马术俱乐部  维修培训  乐乐旅游   西岭雪山专线

我来说两句 】【 我要“揪 ”错 】【 打印 】 【 关闭
  本站编辑 :ncf
相关文章:
佳能打印机部份型号清零方法
WinXP崩溃后的救命稻草
微软全部序列号
显卡代工厂资料大全
感谢以下单位或网站对本站提供稿源支持
新浪科技 sohu IT频 道 IT168笔记本频道 天极网 中关村在线 Enet硅谷动力 太平洋电脑网 倚天硬件门户
同时感谢更多同业网站及媒体提供稿源支持
新闻搜索
热门关键字: 1U 机箱
搜索说 明可输入组合关键字进行搜索 ,以空格分开,如: 复印机 维修
推荐新闻
固顶文章 中维下载中心资料全部
固顶文章 全国最大的视频硬件维
固顶文章 中国维修网成为“温暖
推荐文章 诚信纵深行维护中国打
推荐文章 中维网隆重推出复印机
推荐文章 维修技术培训教学视频
推荐文章 装机过程中10大常规性
推荐文章 WindowsXP SP2遇到蓝屏
推荐文章 无盘终端站的常见精典
推荐文章 破解电信封路由的方法
最新更新
固顶文章 中维下载中心资料全部
固顶文章 全国最大的视频硬件维
固顶文章 中国维修网成为“温暖
普通文章 便宜未必没好货 编辑卖
普通文章 最低1680元 本周4款超
普通文章 打印机厚不足2厘米 日
普通文章 惊呆了 日本三维打印机
普通文章 英特尔新嵌入式平台集
普通文章 游戏高手最爱 7800元轻
普通文章 特别关注!日系最值42吋