리자

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

· 21년 전 · 6211
<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,087
20년 전 조회 2,787
20년 전 조회 1,741
20년 전 조회 1,623
20년 전 조회 2,567
20년 전 조회 1,485
20년 전 조회 1,735
20년 전 조회 3,233
20년 전 조회 1,887
20년 전 조회 1,615
20년 전 조회 4,945
20년 전 조회 4,581
20년 전 조회 3,514
20년 전 조회 3,787
20년 전 조회 7,065
20년 전 조회 3,555
20년 전 조회 2,617
20년 전 조회 2,619
20년 전 조회 7,180
20년 전 조회 4,589
20년 전 조회 1,894
20년 전 조회 3,249
20년 전 조회 1,953
20년 전 조회 1,555
20년 전 조회 2,305
20년 전 조회 1,787
20년 전 조회 1,458
20년 전 조회 1,802
20년 전 조회 2,977
20년 전 조회 2,448
20년 전 조회 1,739
20년 전 조회 1,653
20년 전 조회 3,987
20년 전 조회 2,928
20년 전 조회 3,649
20년 전 조회 3,441
20년 전 조회 3,748
20년 전 조회 8,574
20년 전 조회 2,591
21년 전 조회 3,748
21년 전 조회 3,204
21년 전 조회 2,600
21년 전 조회 2,670
21년 전 조회 2,587
21년 전 조회 2,862
21년 전 조회 3,041
21년 전 조회 5,301
21년 전 조회 3,908
21년 전 조회 4,960
21년 전 조회 6,212
21년 전 조회 7,339
21년 전 조회 1.8만
21년 전 조회 6,880
21년 전 조회 2,884
21년 전 조회 4,139
21년 전 조회 2,484
21년 전 조회 4,312
21년 전 조회 2,894
21년 전 조회 2,251
21년 전 조회 2,467
21년 전 조회 2,228
21년 전 조회 2,565
21년 전 조회 1,737
21년 전 조회 1,573
21년 전 조회 1,630
21년 전 조회 2,119
21년 전 조회 1,878
21년 전 조회 2,379
21년 전 조회 3,570
21년 전 조회 1,571
21년 전 조회 1,762
21년 전 조회 3,182
21년 전 조회 2,348
21년 전 조회 3,174
21년 전 조회 2,886
21년 전 조회 3,310
21년 전 조회 5,126
21년 전 조회 2,526
21년 전 조회 4,820
21년 전 조회 2,506
21년 전 조회 3,114
21년 전 조회 7,622
21년 전 조회 3,828
21년 전 조회 3,215
21년 전 조회 4,704
21년 전 조회 2,898
21년 전 조회 6,231
21년 전 조회 4,486
21년 전 조회 5,789
21년 전 조회 3,638
21년 전 조회 5,971
21년 전 조회 3,118
21년 전 조회 2,832
21년 전 조회 2,626
21년 전 조회 2,435
21년 전 조회 2,645
21년 전 조회 2,676
21년 전 조회 3,795
21년 전 조회 2,816
21년 전 조회 2,468