448191 Posted August 7, 2006 Share Posted August 7, 2006 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"> </div> </a></div>nav should contain "onlineofferte", instead IE complains "parentNode" is empty. Quote Link to comment https://forums.phpfreaks.com/topic/16805-parentnode-empty/ Share on other sites More sharing options...
manmadareddy Posted August 8, 2006 Share Posted August 8, 2006 <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"> </div></div> Quote Link to comment https://forums.phpfreaks.com/topic/16805-parentnode-empty/#findComment-70992 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.