<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>测试</title>
</head>
<body>
<div style="100px; height: 100px; position: relative;">
<div id="div1" style="50px; height: 50px; position: absolute; top: 20px; left: 20px;"></div>
</div>
<input type="button" value="按钮" id="btn1">
<input type="text" id="tex1">
<script>
window.onload=function(){
var oDiv=document.getElementById('div1');
alert(oDiv.offsetParent.tagName);//弹出用于定位的父级.tagName父级名称
}
</script>
</body>
</html>