리자

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

· 21년 전 · 6189
<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,060
20년 전 조회 2,762
20년 전 조회 1,718
20년 전 조회 1,591
20년 전 조회 2,542
20년 전 조회 1,463
20년 전 조회 1,710
20년 전 조회 3,210
20년 전 조회 1,860
20년 전 조회 1,589
20년 전 조회 4,919
20년 전 조회 4,556
20년 전 조회 3,496
20년 전 조회 3,762
20년 전 조회 7,043
20년 전 조회 3,532
20년 전 조회 2,599
20년 전 조회 2,593
20년 전 조회 7,153
20년 전 조회 4,565
20년 전 조회 1,872
20년 전 조회 3,232
20년 전 조회 1,931
20년 전 조회 1,534
20년 전 조회 2,282
20년 전 조회 1,769
20년 전 조회 1,440
20년 전 조회 1,784
20년 전 조회 2,954
20년 전 조회 2,426
20년 전 조회 1,707
20년 전 조회 1,632
20년 전 조회 3,960
20년 전 조회 2,904
20년 전 조회 3,622
20년 전 조회 3,420
20년 전 조회 3,724
20년 전 조회 8,552
20년 전 조회 2,576
21년 전 조회 3,733
21년 전 조회 3,184
21년 전 조회 2,582
21년 전 조회 2,651
21년 전 조회 2,560
21년 전 조회 2,840
21년 전 조회 3,018
21년 전 조회 5,283
21년 전 조회 3,891
21년 전 조회 4,935
21년 전 조회 6,190
21년 전 조회 7,314
21년 전 조회 1.8만
21년 전 조회 6,857
21년 전 조회 2,861
21년 전 조회 4,115
21년 전 조회 2,464
21년 전 조회 4,288
21년 전 조회 2,878
21년 전 조회 2,234
21년 전 조회 2,450
21년 전 조회 2,210
21년 전 조회 2,546
21년 전 조회 1,717
21년 전 조회 1,557
21년 전 조회 1,610
21년 전 조회 2,102
21년 전 조회 1,857
21년 전 조회 2,359
21년 전 조회 3,550
21년 전 조회 1,547
21년 전 조회 1,743
21년 전 조회 3,156
21년 전 조회 2,331
21년 전 조회 3,158
21년 전 조회 2,860
21년 전 조회 3,286
21년 전 조회 5,104
21년 전 조회 2,506
21년 전 조회 4,802
21년 전 조회 2,483
21년 전 조회 3,094
21년 전 조회 7,603
21년 전 조회 3,809
21년 전 조회 3,195
21년 전 조회 4,679
21년 전 조회 2,881
21년 전 조회 6,210
21년 전 조회 4,466
21년 전 조회 5,770
21년 전 조회 3,614
21년 전 조회 5,948
21년 전 조회 3,093
21년 전 조회 2,819
21년 전 조회 2,612
21년 전 조회 2,419
21년 전 조회 2,629
21년 전 조회 2,655
21년 전 조회 3,778
21년 전 조회 2,798
21년 전 조회 2,443
🐛 버그신고