리자

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

· 21년 전 · 6182
<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,054
20년 전 조회 2,754
20년 전 조회 1,711
20년 전 조회 1,583
20년 전 조회 2,534
20년 전 조회 1,456
20년 전 조회 1,703
20년 전 조회 3,204
20년 전 조회 1,854
20년 전 조회 1,582
20년 전 조회 4,911
20년 전 조회 4,547
20년 전 조회 3,489
20년 전 조회 3,753
20년 전 조회 7,035
20년 전 조회 3,525
20년 전 조회 2,592
20년 전 조회 2,585
20년 전 조회 7,144
20년 전 조회 4,559
20년 전 조회 1,867
20년 전 조회 3,225
20년 전 조회 1,925
20년 전 조회 1,526
20년 전 조회 2,275
20년 전 조회 1,761
20년 전 조회 1,432
20년 전 조회 1,776
20년 전 조회 2,946
20년 전 조회 2,418
20년 전 조회 1,700
20년 전 조회 1,625
20년 전 조회 3,954
20년 전 조회 2,896
20년 전 조회 3,615
20년 전 조회 3,410
20년 전 조회 3,711
20년 전 조회 8,547
20년 전 조회 2,569
20년 전 조회 3,724
20년 전 조회 3,175
20년 전 조회 2,574
20년 전 조회 2,643
20년 전 조회 2,553
20년 전 조회 2,833
21년 전 조회 3,011
21년 전 조회 5,276
21년 전 조회 3,884
21년 전 조회 4,927
21년 전 조회 6,183
21년 전 조회 7,307
21년 전 조회 1.8만
21년 전 조회 6,847
21년 전 조회 2,852
21년 전 조회 4,108
21년 전 조회 2,457
21년 전 조회 4,279
21년 전 조회 2,871
21년 전 조회 2,224
21년 전 조회 2,443
21년 전 조회 2,204
21년 전 조회 2,537
21년 전 조회 1,711
21년 전 조회 1,548
21년 전 조회 1,600
21년 전 조회 2,094
21년 전 조회 1,850
21년 전 조회 2,352
21년 전 조회 3,543
21년 전 조회 1,540
21년 전 조회 1,737
21년 전 조회 3,149
21년 전 조회 2,324
21년 전 조회 3,152
21년 전 조회 2,854
21년 전 조회 3,278
21년 전 조회 5,096
21년 전 조회 2,498
21년 전 조회 4,793
21년 전 조회 2,474
21년 전 조회 3,087
21년 전 조회 7,593
21년 전 조회 3,802
21년 전 조회 3,189
21년 전 조회 4,671
21년 전 조회 2,873
21년 전 조회 6,202
21년 전 조회 4,458
21년 전 조회 5,762
21년 전 조회 3,608
21년 전 조회 5,942
21년 전 조회 3,086
21년 전 조회 2,811
21년 전 조회 2,603
21년 전 조회 2,412
21년 전 조회 2,620
21년 전 조회 2,649
21년 전 조회 3,769
21년 전 조회 2,791
21년 전 조회 2,435
🐛 버그신고