ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# parentNode 访问父节点 ~~~ <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>DOM-obj</title> </head> <body> <div> <p id="pid">div的p元素</p> </div> <script> var divNode = document.getElementById('pid'); console.log(divNode.parentNode.nodeName); // DIV </script> </body> </html> ~~~