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 ? Quote Link to comment Share on other sites More sharing options...
genericnumber1 Posted February 7, 2007 Share Posted February 7, 2007 definitely not the right forum Quote Link to comment 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; } Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted February 7, 2007 Share Posted February 7, 2007 add -color after the background. Quote Link to comment 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. Quote Link to comment 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. Quote Link to comment 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';" 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.