리자

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

· 21년 전 · 6179
<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,053
20년 전 조회 2,753
20년 전 조회 1,711
20년 전 조회 1,583
20년 전 조회 2,534
20년 전 조회 1,455
20년 전 조회 1,703
20년 전 조회 3,204
20년 전 조회 1,854
20년 전 조회 1,582
20년 전 조회 4,911
20년 전 조회 4,547
20년 전 조회 3,487
20년 전 조회 3,752
20년 전 조회 7,034
20년 전 조회 3,523
20년 전 조회 2,592
20년 전 조회 2,585
20년 전 조회 7,144
20년 전 조회 4,559
20년 전 조회 1,867
20년 전 조회 3,225
20년 전 조회 1,924
20년 전 조회 1,526
20년 전 조회 2,274
20년 전 조회 1,760
20년 전 조회 1,432
20년 전 조회 1,775
20년 전 조회 2,946
20년 전 조회 2,418
20년 전 조회 1,699
20년 전 조회 1,625
20년 전 조회 3,954
20년 전 조회 2,896
20년 전 조회 3,615
20년 전 조회 3,410
20년 전 조회 3,710
20년 전 조회 8,547
20년 전 조회 2,568
20년 전 조회 3,724
20년 전 조회 3,175
20년 전 조회 2,574
20년 전 조회 2,642
20년 전 조회 2,553
20년 전 조회 2,833
21년 전 조회 3,010
21년 전 조회 5,276
21년 전 조회 3,883
21년 전 조회 4,927
21년 전 조회 6,180
21년 전 조회 7,305
21년 전 조회 1.8만
21년 전 조회 6,846
21년 전 조회 2,851
21년 전 조회 4,106
21년 전 조회 2,456
21년 전 조회 4,279
21년 전 조회 2,871
21년 전 조회 2,224
21년 전 조회 2,443
21년 전 조회 2,204
21년 전 조회 2,537
21년 전 조회 1,710
21년 전 조회 1,548
21년 전 조회 1,599
21년 전 조회 2,093
21년 전 조회 1,850
21년 전 조회 2,352
21년 전 조회 3,542
21년 전 조회 1,539
21년 전 조회 1,736
21년 전 조회 3,149
21년 전 조회 2,324
21년 전 조회 3,151
21년 전 조회 2,854
21년 전 조회 3,278
21년 전 조회 5,094
21년 전 조회 2,497
21년 전 조회 4,792
21년 전 조회 2,474
21년 전 조회 3,086
21년 전 조회 7,593
21년 전 조회 3,802
21년 전 조회 3,188
21년 전 조회 4,671
21년 전 조회 2,873
21년 전 조회 6,201
21년 전 조회 4,458
21년 전 조회 5,762
21년 전 조회 3,607
21년 전 조회 5,942
21년 전 조회 3,086
21년 전 조회 2,809
21년 전 조회 2,602
21년 전 조회 2,411
21년 전 조회 2,619
21년 전 조회 2,646
21년 전 조회 3,768
21년 전 조회 2,791
21년 전 조회 2,434
🐛 버그신고