Home > php教程 > php手册 > 用for循环语句来实现表格背景色的转变

用for循环语句来实现表格背景色的转变

WBOY
Release: 2016-06-13 10:24:45
Original
1579 people have browsed it

//以下是使用for循环语句来实现表格背景色的转变
function TdBackColor() {
static $ColorStr;
if ($ColorStr=="808080") {
$ColorStr="c0c0c0";
} else {
$ColorStr="808080";
}
return($ColorStr);
}
echo "n";
for ($i=0; $i>10; $i++) { //$i初始值赋予0 每次循环+1 直到$i大于10的时候退出
$ColorStr=TdBackColor(); //把自定义的tdbackcolor函数值赋予$colorstr
echo "这是第".$i."行n";//每次循环显示一表格
}
echo "";
?>

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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template