리자

셀렉트박스와 레이어가 겹칠시 레이어가 셀렉트 박스 뒤로 숨는 현상을 해결하는 함수

· 21년 전 · 6194
<script language='JavaScript'>
// Internet Explorer에서 셀렉트박스와 레이어가 겹칠시 레이어가 셀렉트 박스 뒤로 숨는 현상을 해결하는 함수
// 레이어가 셀렉트 박스를 침범하면 셀렉트 박스를 hidden 시킴
// 사용법 :
// <div id=LayerID style="display:none; position:absolute;" onpropertychange="selectbox_hidden('LayerID')">
function selectbox_hidden(layer_id)
{
var ly = eval(layer_id);

// 레이어 좌표
var ly_left = ly.offsetLeft;
var ly_top = ly.offsetTop;
var ly_right = ly.offsetLeft + ly.offsetWidth;
var ly_bottom = ly.offsetTop + ly.offsetHeight;

// 셀렉트박스의 좌표
var el;

for (i=0; i<document.forms.length; i++) {
for (k=0; k<document.forms[i].length; k++) {
el = document.forms[i].elements[k];
if (el.type == "select-one") {
var el_left = el_top = 0;
var obj = el;
if (obj.offsetParent) {
while (obj.offsetParent) {
el_left += obj.offsetLeft;
el_top += obj.offsetTop;
obj = obj.offsetParent;
}
}
el_left += el.clientLeft;
el_top += el.clientTop;
el_right = el_left + el.clientWidth;
el_bottom = el_top + el.clientHeight;

// 좌표를 따져 레이어가 셀렉트 박스를 침범했으면 셀렉트 박스를 hidden 시킴
if ( (el_left >= ly_left && el_top >= ly_top && el_left <= ly_right && el_top <= ly_bottom) ||
(el_right >= ly_left && el_right <= ly_right && el_top >= ly_top && el_top <= ly_bottom) ||
(el_left >= ly_left && el_bottom >= ly_top && el_right <= ly_right && el_bottom <= ly_bottom) ||
(el_left >= ly_left && el_left <= ly_right && el_bottom >= ly_top && el_bottom <= ly_bottom) )
el.style.visibility = 'hidden';
}
}
}
}

// 감추어진 셀렉트 박스를 모두 보이게 함
function selectbox_visible()
{
for (i=0; i<document.forms.length; i++) {
for (k=0; k<document.forms[i].length; k++) {
el = document.forms[i].elements[k];
if (el.type == "select-one" && el.style.visibility == 'hidden')
el.style.visibility = 'visible';
}
}
}
</script><div class='small'>[이 게시물은 관리자님에 의해 2011-10-31 17:16:08 PHP & HTML에서 이동 됨]</div>
|
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

+
제목 글쓴이 날짜 조회
20년 전 조회 2,071
20년 전 조회 2,769
20년 전 조회 1,724
20년 전 조회 1,597
20년 전 조회 2,548
20년 전 조회 1,469
20년 전 조회 1,717
20년 전 조회 3,217
20년 전 조회 1,868
20년 전 조회 1,596
20년 전 조회 4,926
20년 전 조회 4,564
20년 전 조회 3,503
20년 전 조회 3,772
20년 전 조회 7,053
20년 전 조회 3,540
20년 전 조회 2,603
20년 전 조회 2,601
20년 전 조회 7,159
20년 전 조회 4,575
20년 전 조회 1,877
20년 전 조회 3,237
20년 전 조회 1,938
20년 전 조회 1,540
20년 전 조회 2,290
20년 전 조회 1,775
20년 전 조회 1,448
20년 전 조회 1,791
20년 전 조회 2,963
20년 전 조회 2,433
20년 전 조회 1,716
20년 전 조회 1,639
20년 전 조회 3,967
20년 전 조회 2,912
20년 전 조회 3,632
20년 전 조회 3,426
20년 전 조회 3,729
20년 전 조회 8,560
20년 전 조회 2,582
21년 전 조회 3,739
21년 전 조회 3,190
21년 전 조회 2,588
21년 전 조회 2,655
21년 전 조회 2,570
21년 전 조회 2,848
21년 전 조회 3,021
21년 전 조회 5,289
21년 전 조회 3,896
21년 전 조회 4,941
21년 전 조회 6,195
21년 전 조회 7,321
21년 전 조회 1.8만
21년 전 조회 6,864
21년 전 조회 2,866
21년 전 조회 4,124
21년 전 조회 2,472
21년 전 조회 4,292
21년 전 조회 2,884
21년 전 조회 2,243
21년 전 조회 2,459
21년 전 조회 2,216
21년 전 조회 2,554
21년 전 조회 1,724
21년 전 조회 1,564
21년 전 조회 1,619
21년 전 조회 2,107
21년 전 조회 1,863
21년 전 조회 2,369
21년 전 조회 3,555
21년 전 조회 1,555
21년 전 조회 1,750
21년 전 조회 3,165
21년 전 조회 2,339
21년 전 조회 3,164
21년 전 조회 2,867
21년 전 조회 3,295
21년 전 조회 5,110
21년 전 조회 2,512
21년 전 조회 4,810
21년 전 조회 2,489
21년 전 조회 3,098
21년 전 조회 7,607
21년 전 조회 3,814
21년 전 조회 3,202
21년 전 조회 4,687
21년 전 조회 2,890
21년 전 조회 6,217
21년 전 조회 4,469
21년 전 조회 5,776
21년 전 조회 3,622
21년 전 조회 5,954
21년 전 조회 3,101
21년 전 조회 2,826
21년 전 조회 2,617
21년 전 조회 2,423
21년 전 조회 2,636
21년 전 조회 2,664
21년 전 조회 3,783
21년 전 조회 2,804
21년 전 조회 2,451