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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.