contra10 Posted July 21, 2009 Share Posted July 21, 2009 I'm trying to mix css with php if possible using onmouseover I'm withdrawing data into a table and when ever a person goes over a specific area I'm trying to change the back ground heres my coding <style type="text/css"> td.off { background: white; } td.on { background: red; } </style> My php is as follows: <?php $on= "on"; $off= "off"; echo"<td align='center' class='off' onmouseover='this.className=" .$on. "' onmouseout='this.className=" .$off. "'> ?> Quote Link to comment Share on other sites More sharing options...
MadTechie Posted July 21, 2009 Share Posted July 21, 2009 and the problem is ? I'll take a shot and say you mean this echo"<td align='center' class='off' onmouseover='this.className='$on' onmouseout='this.className='$off'>"; Quote Link to comment Share on other sites More sharing options...
contra10 Posted July 21, 2009 Author Share Posted July 21, 2009 i tired that b4 but it didn't work, double quote issue Quote Link to comment Share on other sites More sharing options...
MadTechie Posted July 21, 2009 Share Posted July 21, 2009 okay was it exactly the same, (did you try mine) explain "didn't work" did the plant explode ? Quote Link to comment Share on other sites More sharing options...
contra10 Posted July 21, 2009 Author Share Posted July 21, 2009 i copied it exactly <?php echo"<td td align='center' class='off' onmouseover='this.className='$on' onmouseout='this.className='$off'> ?> but the mouseover doesn't work, it simply stays the same colour - white. Quote Link to comment Share on other sites More sharing options...
MadTechie Posted July 21, 2009 Share Posted July 21, 2009 ahh didn't notice the extra quotes try this <?php echo"<td align='center' class='off' onmouseover='this.className=\"$on\"' onmouseout='this.className=\"$off\"'>"; ?> Quote Link to comment Share on other sites More sharing options...
contra10 Posted July 21, 2009 Author Share Posted July 21, 2009 works, i tried the slashes before but i guess i put an extra one, thanks Quote Link to comment Share on other sites More sharing options...
MadTechie Posted July 21, 2009 Share Posted July 21, 2009 yeah the mouse over needed an extra one 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.