Jump to content


Photo

parentNode empty?


  • Please log in to reply
1 reply to this topic

#1 448191

448191
  • Staff Alumni
  • Advanced Member
  • 3,545 posts
  • LocationNetherlands

Posted 07 August 2006 - 03:06 PM

Anyone see why this doesn't work:

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

<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.




#2 manmadareddy

manmadareddy
  • Members
  • PipPipPip
  • Advanced Member
  • 50 posts

Posted 08 August 2006 - 07:29 AM

<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>





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users