CSDN博客

img smile2me27

以css产生异行异色的table

发表于2004/7/1 10:48:00  2035人阅读

分类: Usable WEB

代码:
background-color:expression((this.previousSibling&&this.previousSibling.style.backgroundColor=="lightskyblue")?"LightSteelBlue":"lightskyblue");

适用:ie5.5以上浏览器

范例:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<style>
table.table1 TR
{
    BACKGROUND-COLOR: expression((this.previousSibling&&this.previousSibling.style.backgroundColor=="lightskyblue")?"LightSteelBlue":"lightskyblue");
}
</style>
</head>
<table class="table1" cellspacing="1" cellpadding="1" width="80%" align="center" border="1">
  <tr>
    <td>ab</td>
    <td>ab</td>
    <td>ab</td>
    <td>ab</td></tr>
  <tr>
    <td>cd</td>
    <td>cd</td>
    <td>cd</td>
    <td>cd</td></tr>
  <tr>
    <td>ef</td>
    <td>ef</td>
    <td>ef</td>
    <td>ef</td></tr>
  <tr>
    <td>gh</td>
    <td>gh</td>
    <td>gh</td>
    <td>gh</td></tr>
  <tr>
    <td>ij</td>
    <td>ij</td>
    <td>ij</td>
    <td>ij</td></tr>
  <tr id="a">
    <td>kl</td>
    <td>kl</td>
    <td>kl</td>
    <td>kl</td></tr>
  <tr>
    <td>mn</td>
    <td>mn</td>
    <td>mn</td>
    <td>mn</td></tr>
  <tr>
    <td>op</td>
    <td>op</td>
    <td>op</td>
    <td>op</td></tr></table>
<body>
</body>
</html>

 

ab ab ab ab
cd cd cd cd
ef ef ef ef
gh gh gh gh
ij ij ij ij
kl kl kl kl
mn mn mn mn
op op op op
0 0

相关博文

我的热门文章

img
取 消
img