The old problem of interlaced color change?
Want to achieve on the Web page to display interlaced color change function, I use the following second method, theoretically yes, the result is a color, later checked, there is the first method, very useful.
just want to know the second method there is a problem, very confused, before all the line, check a lot of information, no detailed, seek expert guidance ...
PHP Code
Method one while ($result =mysql_fetch_array ($query)) { $bgcolor = ($bgcolor = = "Blue")? "White": "Blue"; echo ""; echo "{$result [' Gname ']}"; echo "{$result [' Endtime ']}"; echo "{$result [' Current_price ']}"; echo "{$result [' Reply_num ']}"; echo ""; } Method two $flag =1; while ($result =mysql_fetch_array ($query)) { if ($flag% 2 = = 0) $bgcolor = "Yellow", Else $bgbolor = "white"; This way can theoretically echo ""; echo "{$result [' Gname ']}"; echo "{$result [' Endtime ']}"; echo "{$result [' Current_price ']}"; echo "{$result [' Reply_num ']}"; echo ""; $flag + +; }
------Solution--------------------
For Mao without jquery at the front end do?? The problem is the efficiency of code fetching
------Solution--------------------
if ($flag% 2 = = 0) $bgcolor = "Yellow"; else $bgbolor = "white";
$bgcolor!!!
I wrote it wrong, who is the blame?
------Solution--------------------
Landlord first output $flag% 2
echo $flag% 2;echo '
';
See if the format is x0x0x0x0x0. If yes. Looking for CSS style issues
style= "Background: Color"
------Solution--------------------
discuss
if ($flag% 2 = = 0) $bgcolor = "Yellow"; else $bgbolor = "white";
$bgcolor!!!
I wrote it wrong, who is the blame?