css彩色虚线表格及JS鼠标指向单元格变色制作方法

王朝html/css/js·作者佚名  2008-10-21
窄屏简体版  字體: |||超大  

在我们制作主页的过程中,用到表格的地方非常多,灵活运用表格技巧可以为我们的网页增色不少,这里我就详细介绍CSS彩色虚线表格及JS鼠标指向单元格变色制作方法

一、CSS彩色虚线表格

<style type="text/css">

<!--

.tab1 {

border-top-width: thin;

border-right-width: thin;

border-bottom-width: thin;

border-left-width: thin;

border-top-style: dotted;

border-right-style: dotted;

border-bottom-style: dotted;

border-left-style: dotted;

border-top-color: #00CC66;

border-right-color: #0099CC;

border-bottom-color: #FF0000;

border-left-color: #6699FF;

}

-->

</style>

<p></p>

<table width="230" border="0" cellpadding="2" cellspacing="2" class="tab1" align=center>

<tr>

<td><div align="center">中国asp之家</div></td>

<td><div align="center">虚线</div></td>

</tr>

<tr>

<td><div align="center">样式</div></td>

<td><div align="center">www.devdao.com</div></td>

</tr>

</table>

二、JS鼠标指向单元格变色

onmouseout="this.style.backgroundColor=''" 鼠标离开效果onmouseover="this.style.backgroundColor='#FFcccc'" 鼠标放上去的效果,

如果想让鼠标点击时改变单元格背景色可以这么写

onclick="this.style.backgroundColor='#FFcccc'"

可以修改#FFcccc的值来改变颜色

<table width="227" border="1" cellspacing="0" cellpadding="0" align=center>

<tr>

<td onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#FFcccc'" height=30>鼠标指向单元格变色</td>

</tr>

<tr>

<td onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#FFccaa'" height=30>中国Asp之家,Aspxhome.com</td>

</tr>

</table>

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航