Solved

parentNode from an <a> in a td.

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
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…
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…

744 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now