Jump to content

[SOLVED] DOM background color to a cell


lilman

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.