HTMLで私はこのようなコードを持っています
<body>
  <script src="debug.js"></script>   
  <button id="proof" onclick="debug('result:', this);">proof</button>
</body>
そしてJavaScriptで:
function debug(msg, e) 
{
    var log = document.getElementById("debuglog");
    if (!log)// If no element with the id "debuglog" exists, create one.
    {
        log = document.createElement("div"); /
        log.id = "debuglog";
        log.innerHTML = "<h1>Debug Log</h1>"; 
        document.body.appendChild(log); 
   }
    var pre = document.createElement("pre");
    var text = document.createTextNode(msg + e.parentNode.getElementById("proof")); //<--PROBLEM HERE
    pre.appendChild(text);
    log.appendChild(pre); 
    }
}
テキストノードにmsg + e.parentNodeを書き込んだ場合、コードが機能することに注意してください。一度.getElementById("proof")を追加すると、結果は取得されません (実行時にスクリプトがエラーになると思います)。
私がやりたいことは、HTML要素を「ナビゲート」して、彼の両親と彼の子供たちを呼び出すことです