PunjabHaker Posted February 7, 2007 Share Posted February 7, 2007 print "<td width='10%' align='right' valign='top' onmouseover = this.style.background = 'red' style='border: 1px solid #7F8FA9; background-color:$colors'><center>"; when mouse is over i want it to change the cell color where am i wrong ? Link to comment https://forums.phpfreaks.com/topic/37403-cell-color-onmouseover/ Share on other sites More sharing options...
genericnumber1 Posted February 7, 2007 Share Posted February 7, 2007 definitely not the right forum Link to comment https://forums.phpfreaks.com/topic/37403-cell-color-onmouseover/#findComment-178793 Share on other sites More sharing options...
vbnullchar Posted February 7, 2007 Share Posted February 7, 2007 try this on your stylesheet TR.row_name:hover { cursor:hand; background-color:#ddd; background: url(../images/image.gif); vertical-align:top; } Link to comment https://forums.phpfreaks.com/topic/37403-cell-color-onmouseover/#findComment-178821 Share on other sites More sharing options...
corbin Posted February 7, 2007 Share Posted February 7, 2007 Best I remember, JS can only read style attributes when they're accessed like that. vbnullchar's thing should work perfect though. Link to comment https://forums.phpfreaks.com/topic/37403-cell-color-onmouseover/#findComment-178822 Share on other sites More sharing options...
JasonLewis Posted February 7, 2007 Share Posted February 7, 2007 add -color after the background. Link to comment https://forums.phpfreaks.com/topic/37403-cell-color-onmouseover/#findComment-178946 Share on other sites More sharing options...
mainewoods Posted February 7, 2007 Share Posted February 7, 2007 put 'Color' on back of 'background' (capitalize the 'C') onmouseover = this.style.backgroundColor = 'red' -General rule: to access from javascript a css attribute that normally has a '-' in it, remove the '-' and capitalize the first letter of the word following it. Link to comment https://forums.phpfreaks.com/topic/37403-cell-color-onmouseover/#findComment-179165 Share on other sites More sharing options...
artacus Posted February 7, 2007 Share Posted February 7, 2007 Yeah, you CAN do it that way. But make life easier on yourself and use CSS. If you go the javascript route, you'll also have to change the color back on mouse out. Link to comment https://forums.phpfreaks.com/topic/37403-cell-color-onmouseover/#findComment-179278 Share on other sites More sharing options...
mainewoods Posted February 7, 2007 Share Posted February 7, 2007 should be enclosed in double quotes as well: onmouseover = "this.style.backgroundColor = 'red';" Link to comment https://forums.phpfreaks.com/topic/37403-cell-color-onmouseover/#findComment-179389 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.