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. Link to comment https://forums.phpfreaks.com/topic/41034-solved-dom-background-color-to-a-cell/ 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 Link to comment https://forums.phpfreaks.com/topic/41034-solved-dom-background-color-to-a-cell/#findComment-198705 Share on other sites More sharing options...
lilman Posted March 3, 2007 Author Share Posted March 3, 2007 what about background color: Link to comment https://forums.phpfreaks.com/topic/41034-solved-dom-background-color-to-a-cell/#findComment-198707 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 Link to comment https://forums.phpfreaks.com/topic/41034-solved-dom-background-color-to-a-cell/#findComment-198715 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**'; Link to comment https://forums.phpfreaks.com/topic/41034-solved-dom-background-color-to-a-cell/#findComment-198813 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 Link to comment https://forums.phpfreaks.com/topic/41034-solved-dom-background-color-to-a-cell/#findComment-198818 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.