derbystar16 Posted February 23, 2007 Share Posted February 23, 2007 Hi I need to know how to change the background color of any particular row within a dynamic region. I have a table pulling in data from a MYSQL DB and it's repeating to show all records. But I do not know how to reference any particular record within that repeated region since the ID's will all be the same. Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/39726-dynamic-table-in-repeated-region-same-ids-for-all-shown-records/ Share on other sites More sharing options...
cmgmyr Posted February 23, 2007 Share Posted February 23, 2007 First this is done with CSS and you should use classes instead of ID's. Check this out: http://www.somacon.com/p338.php Quote Link to comment https://forums.phpfreaks.com/topic/39726-dynamic-table-in-repeated-region-same-ids-for-all-shown-records/#findComment-191810 Share on other sites More sharing options...
jcbarr Posted February 23, 2007 Share Posted February 23, 2007 Also, try to only post one topic for your question. There is no need to start multiple topics asking the same question. Quote Link to comment https://forums.phpfreaks.com/topic/39726-dynamic-table-in-repeated-region-same-ids-for-all-shown-records/#findComment-191814 Share on other sites More sharing options...
magic2goodil Posted February 23, 2007 Share Posted February 23, 2007 Why are you giving them the same ID? You should give them each a unique name instead. And then if you want to change the background color, you can use javascript to do such. How exactly are you wanting the background change to execute? onMouseOver? onClick? etc.. Quote Link to comment https://forums.phpfreaks.com/topic/39726-dynamic-table-in-repeated-region-same-ids-for-all-shown-records/#findComment-191819 Share on other sites More sharing options...
derbystar16 Posted February 23, 2007 Author Share Posted February 23, 2007 I'm not giving them the same ID. I create one table, insert all of my dynamic data, then I repeat the region. Since I'm repeating the table, the table ID is the same for all records. Quote Link to comment https://forums.phpfreaks.com/topic/39726-dynamic-table-in-repeated-region-same-ids-for-all-shown-records/#findComment-191821 Share on other sites More sharing options...
derbystar16 Posted February 23, 2007 Author Share Posted February 23, 2007 cmgmyr, I dont want to alternate the colors of the rows in a pattern (ie. black white black white etc) This is a dynamic table. If a column has a certain value, I want to change that rows color. I just cant seem to figure out how to do it. I can get it to work in FF but not in IE and Safari and I Think it has something to do with the ID. Since I'm repeating the table, the ID stays the same for each record occurance. Quote Link to comment https://forums.phpfreaks.com/topic/39726-dynamic-table-in-repeated-region-same-ids-for-all-shown-records/#findComment-191822 Share on other sites More sharing options...
cmgmyr Posted February 23, 2007 Share Posted February 23, 2007 do you have a live page or an example that we can look at? Quote Link to comment https://forums.phpfreaks.com/topic/39726-dynamic-table-in-repeated-region-same-ids-for-all-shown-records/#findComment-191824 Share on other sites More sharing options...
derbystar16 Posted February 23, 2007 Author Share Posted February 23, 2007 <td width="10%" align="center" bordercolor="#FBFBFB" bgcolor="#99CCFF" id="idStatus"><span class="style9"> <?php echo $row_Recordset1['status']; ?> </span> <script> var status = '<?php echo $row_Recordset1['status']; ?>' var element = document.getElementById("idStatus"); if (status == "CLOSED") element.style.backgroundColor = "#000000"; </script> </td> This code works perfectly in FF but not in IE or Safari Quote Link to comment https://forums.phpfreaks.com/topic/39726-dynamic-table-in-repeated-region-same-ids-for-all-shown-records/#findComment-191828 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.