리자

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

· 21년 전 · 6185
<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,057
20년 전 조회 2,757
20년 전 조회 1,715
20년 전 조회 1,587
20년 전 조회 2,538
20년 전 조회 1,459
20년 전 조회 1,707
20년 전 조회 3,207
20년 전 조회 1,858
20년 전 조회 1,586
20년 전 조회 4,916
20년 전 조회 4,552
20년 전 조회 3,494
20년 전 조회 3,759
20년 전 조회 7,040
20년 전 조회 3,528
20년 전 조회 2,595
20년 전 조회 2,589
20년 전 조회 7,148
20년 전 조회 4,561
20년 전 조회 1,870
20년 전 조회 3,229
20년 전 조회 1,928
20년 전 조회 1,530
20년 전 조회 2,277
20년 전 조회 1,764
20년 전 조회 1,437
20년 전 조회 1,780
20년 전 조회 2,950
20년 전 조회 2,423
20년 전 조회 1,703
20년 전 조회 1,629
20년 전 조회 3,958
20년 전 조회 2,900
20년 전 조회 3,619
20년 전 조회 3,415
20년 전 조회 3,719
20년 전 조회 8,551
20년 전 조회 2,572
20년 전 조회 3,728
20년 전 조회 3,179
20년 전 조회 2,578
20년 전 조회 2,646
20년 전 조회 2,557
20년 전 조회 2,838
21년 전 조회 3,016
21년 전 조회 5,280
21년 전 조회 3,887
21년 전 조회 4,932
21년 전 조회 6,186
21년 전 조회 7,311
21년 전 조회 1.8만
21년 전 조회 6,852
21년 전 조회 2,857
21년 전 조회 4,111
21년 전 조회 2,461
21년 전 조회 4,283
21년 전 조회 2,873
21년 전 조회 2,228
21년 전 조회 2,447
21년 전 조회 2,208
21년 전 조회 2,541
21년 전 조회 1,714
21년 전 조회 1,552
21년 전 조회 1,605
21년 전 조회 2,098
21년 전 조회 1,854
21년 전 조회 2,356
21년 전 조회 3,546
21년 전 조회 1,544
21년 전 조회 1,740
21년 전 조회 3,153
21년 전 조회 2,327
21년 전 조회 3,155
21년 전 조회 2,857
21년 전 조회 3,283
21년 전 조회 5,099
21년 전 조회 2,502
21년 전 조회 4,798
21년 전 조회 2,479
21년 전 조회 3,091
21년 전 조회 7,598
21년 전 조회 3,807
21년 전 조회 3,192
21년 전 조회 4,676
21년 전 조회 2,877
21년 전 조회 6,205
21년 전 조회 4,462
21년 전 조회 5,766
21년 전 조회 3,611
21년 전 조회 5,946
21년 전 조회 3,090
21년 전 조회 2,815
21년 전 조회 2,608
21년 전 조회 2,417
21년 전 조회 2,624
21년 전 조회 2,652
21년 전 조회 3,774
21년 전 조회 2,795
21년 전 조회 2,439
🐛 버그신고