'parentNode' Example : parentNode « Javascript Properties « JavaScript Reference

'parentNode' Example

    
<html>
<body>
<form id="myF">
    <input id="myB" type="button" value="Show parent node" onclick="function1();">
</form>
<script language="JavaScript">
function function1() {
    var m = document.all.myB.parentNode.id;
    alert("Parent node: <form>, id = "+'"'+m+'"'); 
} 
</script>
</body>
</html>

    
      
      








Related examples in the same category

1.'parentNode' Syntax and Note
2.'parentNode' is applied to