Copy Code code as follows:
<?php
/* Loop structure
* One, while loop
* while (expression)
* {
* loop body;/execute repeatedly until the expression is false
* }
* Second, Do-while cycle
* Three, for loop
*
* There are two types of loops that vary according to the cyclic conditions
*
* One: Counting loops (general use for)
* Another: Conditional loops (general use while do-while)
*
*
*
*/
The use of While
/* $num = 0;
while ($num <100)
{
echo "Output {$num}";
$num + +;
}*/
While output table
Echo ' <table border= "1" width= "align=" center ">";
Echo ' <caption>$i = 0;
while ($i <1000)
{
Change the line 10 times
if ($i%10==0)
{
if ($i%20==0)
{
$BG = "#ffffff";
}
Else
{
$BG = "#cccccc";
}
Echo ' <tr onmouseover= ' Orow (This) "onmouseout=" Nrow (This) "bgcolor=". $bg. ' > '//Output interlace color
}
Echo ' <td> '. $i. ' </td> ';
$i + +;
if ($i%10==0)
{
Echo ' </tr> ';
}
}
Echo ' </table> ';
?>
<script type= "Text/javascript" >
var old=null;
Background with yellow color when mouse is put on
function Orow (obj)
{
Old=obj.bgcolor;
Obj.bgcolor= ' Yellow ';
}
Return the original color when the mouse leaves
function Nrow (obj)
{
Obj.bgcolor=old;
}
</script>