Link to home
Start Free TrialLog in
Avatar of steveo225
steveo225Flag for United States of America

asked on

Accessing an objects parent object

I have an object, but need to get the handle for that object's parent, for example

<script>
function x(obj){
    obj=obj.parent;
    // do stuff to the parent object
}
</script>
<div><span onmousedown="x(this)">This is a span inside a div</span></div>

In that example, when the function "x" is executed it is passed the handle for the span, but I need the handle for the div that contains the span. Unfortunately what I have does not work, any ideas?
ASKER CERTIFIED SOLUTION
Avatar of Tomarse111
Tomarse111
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of steveo225

ASKER

ah, so close, just missing 'Node'

Thanks a lot