역시나 그대로 붙여넣기 하고 한 개씩 적어보면 바로 이해할 수 있는 직관적인 코드 ㄱㄱ
<script type="text/javascript">
// 화면 로드 후 처리
window.onload = function()
{
// 여기에 입력할 요소들 ID 넣으면 됨
setDivHeight('sidebar-primary','page-titlebar','page-breadcrumb');
}
// 입력한 요소들을 스크립트 명명 (obj_1)
function setDivHeight(obj_1, obj_2, obj_3)
{
var obj_1 = document.getElementById(obj_1);
// 기준 요소
var obj_2Height= document.getElementById(obj_2).offsetHeight;
var obj_3Height= document.getElementById(obj_3).offsetHeight;
// 다른 요소들 높이 명명
var A_Height= -150;
var C_Height= A_Height - obj_3Height - obj_2Height;
// 사칙연산
obj_1.style.top = C_Height + "px";
}
</script>