Use the for loop statement to change the background color of a table. The following code uses the for loop statement to convert the background color of a table: functionTdBackColor () {static $ ColorStr; if ($ ColorStr808080) {$ ColorStrc0c0c0 ;} else {$ ColorStr8080 // use the for loop statement to change the background color of the table.
Function TdBackColor (){
Static $ ColorStr;
If ($ ColorStr = "808080 "){
$ ColorStr = "c0c0c0 ";
} Else {
$ ColorStr = "808080 ";
}
Return ($ ColorStr );
}
Echo "n ";
For ($ I = 0; $ I> 10; $ I ++) {// $ I: The initial value is 0. each cycle is given + 1 until $ I is greater than 10.
$ ColorStr = TdBackColor (); // assign the custom tdbackcolor function value to $ colorstr
Echo "this is the first". $ I. "row n"; // A table is displayed in each loop.
}
Echo "";
?>
Functions TdBackColor () {static $ ColorStr; if ($ ColorStr = "808080") {$ ColorStr = "c0c0c0";} else {$ ColorStr = "8080...