Solved

parentNode from an <a> in a td.

Posted on 2006-06-24
2
663 Views
Last Modified: 2008-03-17
Howdy.

I got this structure: <td style="background-color: #000000"><a href="javascript:Pick(this);"></a></td>

I want to get the background-color value with JS, I tried to access the TD by:

function Pick(color) {
  alert(color.parentNode);
}

But it returns undefined.

Help would be appreciated.
0
Comment
Question by:shmulik15
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 25

Accepted Solution

by:
devic earned 125 total points
ID: 16976431
<script>
function Pick(obj)
{
  alert(obj.parentNode.style.backgroundColor);
}
</script>
<table>
      <td style="background-color: #000000"><a href="#" onclick="Pick(this); return false;">aaa</a></td>
</table>      
0
 

Author Comment

by:shmulik15
ID: 16976441
Thanks devic.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question