Home > Backend Development > PHP Tutorial > Use for loop statement to change table background color_PHP tutorial

Use for loop statement to change table background color_PHP tutorial

WBOY
Release: 2016-07-13 17:24:28
Original
1344 people have browsed it

//The following is a for loop statement used 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++) { //The initial value of $i is assigned 0, +1 each time it loops until $i is greater than 10 and exit
$ColorStr=TdBackColor() ; //Assign the custom tdbackcolor function value to $colorstr
echo "This is the ".$i." line n";//Display a table each time in the loop
}
echo "";
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/532140.htmlTechArticle//The following is a for loop statement used to change the background color of the table function TdBackColor() { static $ColorStr; if ($ColorStr=="808080") { $ColorStr="c0c0c0"; } else { $ColorStr="8080...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template