Jump to content

Archived

This topic is now archived and is closed to further replies.

448191

parentNode empty?

Recommended Posts

Anyone see why this doesn't work:

[code]function request(linkNode) {
var nav = linkNode.parentNode.getAttribute('id');
          //etc
}[/code]

<div class="subnavselected" id="onlineofferte" onmouseover="subnav(this,'over');"
onmouseout="subnav(this,'out');" onclick="subnav(this,'click');">
<a href="javascript:request(this);">
<img src="img.php?f=subnav/offerte.gif" alt=""/>
<div id="onlineofferteline" class="subnavselectedline">&nbsp;</div>
</a>
</div>

nav should contain "onlineofferte", instead IE complains "parentNode" is empty.


Share this post


Link to post
Share on other sites
<SCRIPT LANGUAGE="JavaScript">
<!--
function request(){ 
    alert(document.getElementById("test").parentNode.id);
    //etc
}
function subnav(obj,par)
{
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<div class="subnavselected" id="onlineofferte" onmouseover="subnav(this,'over');"
        onmouseout="subnav(this,'out');" onclick="subnav(this,'click');"><a href="javascript:request();" id='test' ><img src="img.php?f=subnav/offerte.gif" alt=""/></a>
      <div id="onlineofferteline" class="subnavselectedline">&nbsp;</div>
</div>

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.