Using for loop statements to change the background color of a table _ PHP Tutorial

Source: Internet
Author: User
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...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.