리자

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

· 21년 전 · 6236
<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,110
20년 전 조회 2,810
20년 전 조회 1,764
20년 전 조회 1,653
20년 전 조회 2,593
20년 전 조회 1,509
20년 전 조회 1,765
20년 전 조회 3,257
20년 전 조회 1,912
20년 전 조회 1,643
20년 전 조회 4,977
20년 전 조회 4,607
20년 전 조회 3,538
20년 전 조회 3,812
20년 전 조회 7,086
20년 전 조회 3,575
20년 전 조회 2,644
20년 전 조회 2,646
20년 전 조회 7,205
20년 전 조회 4,616
20년 전 조회 1,916
20년 전 조회 3,277
20년 전 조회 1,975
20년 전 조회 1,584
20년 전 조회 2,335
20년 전 조회 1,813
20년 전 조회 1,482
20년 전 조회 1,833
20년 전 조회 3,011
20년 전 조회 2,466
20년 전 조회 1,763
20년 전 조회 1,683
20년 전 조회 4,012
20년 전 조회 2,955
20년 전 조회 3,675
20년 전 조회 3,465
20년 전 조회 3,770
20년 전 조회 8,597
21년 전 조회 2,616
21년 전 조회 3,770
21년 전 조회 3,231
21년 전 조회 2,631
21년 전 조회 2,696
21년 전 조회 2,614
21년 전 조회 2,889
21년 전 조회 3,068
21년 전 조회 5,326
21년 전 조회 3,933
21년 전 조회 4,980
21년 전 조회 6,237
21년 전 조회 7,366
21년 전 조회 1.8만
21년 전 조회 6,905
21년 전 조회 2,904
21년 전 조회 4,165
21년 전 조회 2,507
21년 전 조회 4,333
21년 전 조회 2,916
21년 전 조회 2,272
21년 전 조회 2,492
21년 전 조회 2,254
21년 전 조회 2,584
21년 전 조회 1,771
21년 전 조회 1,601
21년 전 조회 1,660
21년 전 조회 2,144
21년 전 조회 1,899
21년 전 조회 2,401
21년 전 조회 3,588
21년 전 조회 1,593
21년 전 조회 1,790
21년 전 조회 3,205
21년 전 조회 2,375
21년 전 조회 3,196
21년 전 조회 2,908
21년 전 조회 3,328
21년 전 조회 5,145
21년 전 조회 2,554
21년 전 조회 4,846
21년 전 조회 2,535
21년 전 조회 3,140
21년 전 조회 7,646
21년 전 조회 3,854
21년 전 조회 3,238
21년 전 조회 4,725
21년 전 조회 2,931
21년 전 조회 6,258
21년 전 조회 4,510
21년 전 조회 5,811
21년 전 조회 3,662
21년 전 조회 5,992
21년 전 조회 3,140
21년 전 조회 2,861
21년 전 조회 2,656
21년 전 조회 2,463
21년 전 조회 2,667
21년 전 조회 2,703
21년 전 조회 3,820
21년 전 조회 2,841
21년 전 조회 2,490