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
Solved

parentNode from an <a> in a td.

Posted on 2006-06-24
2
660 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
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Head to not include on scroll 4 23
check a checkbox of a checkboxes group in bootstrap 2 40
suddenly angular cli doesn't work. 5 38
jQuery on Submit 4 37
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…

808 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