asmith Posted November 30, 2007 Share Posted November 30, 2007 i have some results from a table , i want to show them in html table tag . each row of mysql table goes to each row of html table tag. the question i've got is: what s the simplest way to switch the background colors of html table rows, you know for example odd rows goes white, even rows goes grey... Quote Link to comment Share on other sites More sharing options...
revraz Posted November 30, 2007 Share Posted November 30, 2007 For me, using CSS. Quote Link to comment Share on other sites More sharing options...
asmith Posted November 30, 2007 Author Share Posted November 30, 2007 you define 2 classes for both rows, then apply CSS to them? Quote Link to comment Share on other sites More sharing options...
adam291086 Posted November 30, 2007 Share Posted November 30, 2007 this is how i did in using php for ($i = 0; $i < $_POST['num_images']; $i++){ // Determine alternate row colours if($i % 2 == 0){ $style = "bgcolor=\"#FFFFFF\""; $bottomstyle = "bgcolor=\"#FFFFFF\""; } else { $style = "bgcolor=\"#EFEFEF\""; $bottomstyle = "bgcolor=\"#EFEFEF\""; } Quote Link to comment Share on other sites More sharing options...
asmith Posted November 30, 2007 Author Share Posted November 30, 2007 gotcha ! thanks ! Quote Link to comment Share on other sites More sharing options...
roadshow Posted November 30, 2007 Share Posted November 30, 2007 if ($color == $color1){ $color = $color2; }ELSE{ $color = $color1; } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.