alexcmm Posted November 20, 2006 Share Posted November 20, 2006 So, I'm finding that Javascript succums to the PHP alternating row color... by that I mean that the Javascript hover will work if I don't use the PHP alternating row colors. Is there a pure PHP way to do both? I really only HAVE to make this work in IE, but cross platform would be cool.Here's the alt row PHP I have now:[code]for($i = 0; $i < $numofrows; $i++) { $row = mysql_fetch_array($result); //get a row from our result set if($i % 2) { //this means if there is a remainder echo "<TR bgcolor=\"#F0EEEE\">\n"; } else { //if there isn't a remainder we will do the else echo "<TR bgcolor=\"white\">\n";[/code] Link to comment https://forums.phpfreaks.com/topic/27827-alternating-rows-with-hover-color-change-is-it-possible/ Share on other sites More sharing options...
alexcmm Posted November 20, 2006 Author Share Posted November 20, 2006 Really... nobody has any info on this? if it's possible? anything?? Link to comment https://forums.phpfreaks.com/topic/27827-alternating-rows-with-hover-color-change-is-it-possible/#findComment-127464 Share on other sites More sharing options...
.josh Posted November 20, 2006 Share Posted November 20, 2006 you cannot make row colors change on hover with php. php is a server side language. everything is parsed on the server and then sent to the client (your browser). You can use php to alternate the colors, but you need to use javascript to make it change colors when you hover. Link to comment https://forums.phpfreaks.com/topic/27827-alternating-rows-with-hover-color-change-is-it-possible/#findComment-127474 Share on other sites More sharing options...
CheesierAngel Posted November 20, 2006 Share Posted November 20, 2006 You can also use css to change the colors for hovering.You only need to specify the class in your html tag, css will do the rest.[code]<table><tr class="tableHover" bgcolor="white"> <td>some info</td> <td>some info</td></tr></table>=> CSStr.tableHover:HOVER { background-color: #F0EEEE;}[/code] Link to comment https://forums.phpfreaks.com/topic/27827-alternating-rows-with-hover-color-change-is-it-possible/#findComment-127480 Share on other sites More sharing options...
kenrbnsn Posted November 20, 2006 Share Posted November 20, 2006 That is not completely true. You can use CSS to make colors change on hover. In IE the hover attribute only works on addresses. If you can enclose each row in an <a> tag (without an "href" tag) with a particular CSS class, you can use PHP to switch the CSS class to change the hover color.Ken Link to comment https://forums.phpfreaks.com/topic/27827-alternating-rows-with-hover-color-change-is-it-possible/#findComment-127482 Share on other sites More sharing options...
alexcmm Posted November 20, 2006 Author Share Posted November 20, 2006 [quote author=kenrbnsn link=topic=115605.msg470940#msg470940 date=1164037166]you can use PHP to switch the CSS class to change the hover color.[/quote]Ken,can you show me an example of this? Link to comment https://forums.phpfreaks.com/topic/27827-alternating-rows-with-hover-color-change-is-it-possible/#findComment-127528 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.