while(){}的高级用法
<?php
/*$ip="127.0.0.1";
if($_SERVER["REMOTE_ADDR"]==$ip){
header("location:xxx.php");
}else{
header("location:yyy.php");
}
function limitIp($ip){
if($_SERVER[REMOTE_ADDR]==$ip){
header("location:XXx.php");
}else{
header("location:YYY.php");
}
}*/
/*
echo "<table border=1 width=800 align=center>";
echo "<caption><h1>学生成绩</h1></caption>";
$i=0;
$j=0;
while($i<1000){
if($i%10==0){
if($j++%2==0){
$bgc="#cccccc";
}else{
$bgc="aaffaa";
}
//echo "<tr bgcolor=$bgc>";
echo "<tr onmouseover=show(this) onmouseout=noshow(this) bgcolor=".$bgc.">";
}
echo "<td>$i</td>";
if(++$i%10==0){
echo "</tr>";
}
}
echo "<table>";
*/
echo "<table width=800 border=1 align=center>";
echo "<caption><h1>学生成绩</h1></caption>";
$i=0;
$k=0;
while($i<100){
if($i%2==0){
$bgc="#cccccc";
}else{
$bgc="#aaffaa";
}
echo "<tr onmouseover=show(this) onmouseout=noshow(this) bgcolor=$bgc>";
$j=0;
while($j<10){
echo "<td>$k</td>";
$j++;
$k++;
}
echo "</tr>";
$i++;
}
echo "</table>";
?>
<script>
var yuancolor=null;
function show(obj){
yuancolor=obj.style.backgroundColor;
obj.style.backgroundColor="red";
}
function noshow(obj){
obj.style.backgroundColor=yuancolor;
}
</script>
补充:Web开发 , php ,