欢迎来 起落博客 加入收藏 设为主页

php输出表格 (改进版)



<?php
echo “<table border=0.5 width=80% align=center>”;
print”<caption><h2>xxx</h2></caption>”;
$i=1;
$k=1;
   while($i<=10){ 
   if($i%2==0){$bgc=”#66ff66″;}else{$bgc=”#00ffff”;}
   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>”);
echo”<hr size=2>”;
print “<table border=0.5 width=80% align=center>”;
for($i=1;$i<11;){
   if($i%2==0){$bgc=”#666666″;}else{$bgc=”#ff11ff”;}
   echo”<tr bgcolor=’$bgc’ onmouseover=’show(this);’ onmouseout=’noshow(this);’>”;
   $j=1;
   for(;$j<=10;){
   $a=rand();
   echo”<td>”.$a.”</td>”;
   $j++;
   }
   echo”</tr>”;
   $i++;
}
print(“</table>”);
?>
<script language=”javascript”>
  function show(obj){
  obj.style.backgroundColor=”red”;
  }
  function noshow(obj){
  obj.style.backgroundColor=””;
  }
</script>

原创文章,转载请注明:起落SEO博客
本文链接地址: http://76tui.net/archives/35.html

发表评论

Your email is never published nor shared. Required fields are marked *

*

*

=7496*

输入您的评论:


评论