zoukankan      html  css  js  c++  java
  • css控制表格交替颜色

    奇妙的样式表语法
     <style type="text/css">
     
    <!--
     tr 
    {background-color:expression((this.sectionRowIndex%2==0)?"red":"blue")}
     td 
    {background-color:expression((this.cellIndex%2==0)?"":((this.parentElement.sectionRowIndex%2==0)?"green":"yellow"))}
     
    -->
     
    </style>
     
    </HEAD>
     
    <table>
     
    <tr><td>第1行</td><td>第1行</td><td>第1行</td><td>第1行</td><td>第1行</td></tr>
     
    <tr><td>第2行</td><td>第2行</td><td>第2行</td><td>第2行</td><td>第2行</td></tr>
     
    <tr><td>第3行</td><td>第3行</td><td>第3行</td><td>第3行</td><td>第3行</td></tr>
     
    <tr><td>第4行</td><td>第4行</td><td>第4行</td><td>第4行</td><td>第4行</td></tr>
     
    <tr><td>第5行</td><td>第5行</td><td>第5行</td><td>第5行</td><td>第5行</td></tr>
     
    </table>
     
    //myhyli @ blueidea
     


    控制鼠标移动颜色
    <style>
    tr
    {background-color:expression((this.rowIndex%2==0)?"blue":"red");ryo:expression(onmouseover=function(){this.style.backgroundColor=(this.style.backgroundColor!='gray'?'gray':((this.rowIndex%2==0)?"blue":"red"))},onmouseout=function(){this.style.backgroundColor=(this.style.backgroundColor!='gray'?'gray':((this.rowIndex%2==0)?"blue":"red"))})}
    </style>
    <TABLE width="200" cellpadding="0" cellspacing="2" border="0" id="t1">
    <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>
  • 相关阅读:
    并发编程---守护进程
    并发编程---Process对象的其他属性或方法
    并发编程---开启进程方式---查看进程pid
    并发编程---操作系统
    ie浏览器的css bug
    链接内的图片与文字如何对齐?
    inline元素特性
    最大流EK算法模板
    数据结构 链式表
    运算表达式 栈应用
  • 原文地址:https://www.cnblogs.com/yg_zhang/p/570489.html
Copyright © 2011-2022 走看看