function getrowbg() {         
   global $i;
   if (isset($i)) {
        if ($i%2==0) {
         $i=1;
         return "#FFFFFF";   
} else {
         $i=0;
             return "#e7e7e7";
         }  
  }

解决方案 »

  1.   

    <tr bgcolor="<?php $bgcolor = ($bgcolor == "#EEEEEE")? "#CCCCCC": "#EEEEEE"; ?>">
      

  2.   

    这种问题用css 就能解决,你写php做什么table.ChenHuiDotNet{
    width:100%;padding:0px;margin:0px;
    }
    table.ChenHuiDotNet TR.Title{
    font-size:14px; height:24px;text-align:center;
    border-width: 0px;
    border-top-style: none;
    border-bottom-style: dashed;
    overflow: hidden; text-overflow:ellipsis;
    color:#721480;
    BACKGROUND-COLOR:#F5C5E2;
    }
    table.ChenHuiDotNet TR.Title td{
    color:#C52672;
    }table.ChenHuiDotNet TR.Row{
    font-size:14px; height:24px;
    /*BACKGROUND-COLOR: expression((this.sectionRowIndex%2==0)?"#FFFFCC":"#fff9f0");*/
    BACKGROUND-COLOR: expression((this.sectionRowIndex%2==0)?"#eeeeee":"#fff9f0");
    ChenHui:expression(onmouseout=function(){
        this.backgroundColor="#CCCCCC";
       },onmouseover=function(){
    this.backgroundColor="#003c9c";
       },onmousedown=function(){
    this.borderBottomColor = "#F4E088";
       });
    word-wrap: break-word; word-break: break-all;overflow: hidden; text-overflow:ellipsis;
    }
    table.ChenHuiDotNet TR.Row td{
    border-bottom-width: 1px;border-bottom-color: #CCCCCC;border-bottom-style: solid ;
    }
      

  3.   

    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="ChenHuiDotNet">
    <tr class="Title">
      <td align="center">列名</td>
    </tr>
    <tr class="Row">
      <td align="center">99999999999999999</td>
    </tr>
    </TABLE>
      

  4.   

    用javascript在页面load时observe一个事件对表格行进行操作,这样做好处如下:css的expression做法不跨浏览器;降低数传量;减小服务器负担; 合理利用客户端资源
      

  5.   

    晕~~
    为什么我在那里问都要说要css呢
    用css
    .switchtr {background-color:expression((this.sectionRowIndex%2==0)?"#e7e7e7":"#ffffff")}
    这里更简单
    我只想为什么上面的不行而以
      

  6.   

    3楼正解,呵呵,这种问题用PHP解决,用错地方了。