By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,241 Members | 760 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,241 IT Pros & Developers. It's quick & easy.

Changing background color with javascript

P: 89

I have a problem with changing the background color in a table cell when i click on the content in the cell.

Here is my code:

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. var ie = document.all
  3. var ns = document.getElementById && !ie
  4. function rowclick(e) {
  5. var obj = ns ? : event.srcElement
  6. if ("click") {
  8. obj.onblur=function() {
  10. }
  11. }
  12. }
  13. document.onclick=rowclick
  14. </script>
And i call it by using:
Expand|Select|Wrap|Line Numbers
  1. <a href="#" id="click">Some text</a>
Now, this works fine. The background changes when i click the cell content.

The real problem is that i have cells with two different original background colors.

How do i do this, so that the original background returns when clicking another content in another cell with different background.........?
May 25 '07 #1
Share this Question
Share on Google+
1 Reply

P: 2,476
write down .....

Expand|Select|Wrap|Line Numbers
best of luck.

kind regards.
May 25 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.