lilman Posted March 3, 2007 Share Posted March 3, 2007 I wrote this JavaScript code so when the mouse rolls over it, it will change the background color. I would also like to get it to change the border color as well. I did not get it to work with the background color yet so I haven't even attempted to change the border. Here is the JS function: <script type="text/javascript"> function mouseover() { document.getElementById('link').bgcolor="#000000" } </script> This is the code I call it from: <th class="td" id="link" width="100%" onmouseover="mouseover()" height="17">Link Text</th> If someone could help me as I am new to JavaScript I would appreciate it. Thank you. Quote Link to comment Share on other sites More sharing options...
LazyJones Posted March 3, 2007 Share Posted March 3, 2007 document.getElementById('link').border could work document.getElementById('link').style.border should work Quote Link to comment Share on other sites More sharing options...
lilman Posted March 3, 2007 Author Share Posted March 3, 2007 what about background color: Quote Link to comment Share on other sites More sharing options...
LazyJones Posted March 3, 2007 Share Posted March 3, 2007 oh, sorry I missed that you could try .style.background-color Not on expert on JavaScript, but something I would try Quote Link to comment Share on other sites More sharing options...
mainewoods Posted March 3, 2007 Share Posted March 3, 2007 This is what you want: document.getElementById('link').style.backgroundColor = '**color**'; Quote Link to comment Share on other sites More sharing options...
LazyJones Posted March 3, 2007 Share Posted March 3, 2007 another reason I hate JavaScript, strange naming conventions also found a link that may help you in the future exploration http://www.comptechdoc.org/independent/web/cgi/javamanual/javastyle.html 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.