【小实例】php输出表格 滑过行颜色

来源:互联网 发布:cf客户端数据异常23 0 编辑:程序博客网 时间:2024/05/16 17:01
<?php
echo "<table border=1 width=80%>";
print"<caption><h2>xxx</h2></caption>";
$i=1;
$k=1;
while($i<=10){
   if($i%2==0){$bgc="#006666";}else{$bgc="#0011ff";}
   echo"<tr bgcolor='$bgc' onmouseover='show(this);' onmouseout='noshow(this);'>";
   $j=1;
   while($j<=10){
   echo"<td>".$k++."</td>";
   $j++;
   }
   echo"</tr>";
   $i++;
}
print("</table>");
?>
<script language="javascript">
  function show(obj){
  obj.style.backgroundColor="red";
  }
  function noshow(obj){
  obj.style.backgroundColor="";
  }
</script>
原创粉丝点击