Old related problems of interlaced color change

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