리자

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

· 21년 전 · 6186
<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,760
20년 전 조회 1,716
20년 전 조회 1,588
20년 전 조회 2,538
20년 전 조회 1,461
20년 전 조회 1,708
20년 전 조회 3,208
20년 전 조회 1,860
20년 전 조회 1,588
20년 전 조회 4,917
20년 전 조회 4,552
20년 전 조회 3,494
20년 전 조회 3,759
20년 전 조회 7,041
20년 전 조회 3,530
20년 전 조회 2,597
20년 전 조회 2,590
20년 전 조회 7,149
20년 전 조회 4,565
20년 전 조회 1,870
20년 전 조회 3,231
20년 전 조회 1,930
20년 전 조회 1,531
20년 전 조회 2,281
20년 전 조회 1,768
20년 전 조회 1,440
20년 전 조회 1,780
20년 전 조회 2,953
20년 전 조회 2,424
20년 전 조회 1,706
20년 전 조회 1,631
20년 전 조회 3,960
20년 전 조회 2,900
20년 전 조회 3,621
20년 전 조회 3,416
20년 전 조회 3,721
20년 전 조회 8,551
20년 전 조회 2,575
20년 전 조회 3,730
20년 전 조회 3,182
20년 전 조회 2,581
20년 전 조회 2,648
20년 전 조회 2,558
20년 전 조회 2,839
21년 전 조회 3,017
21년 전 조회 5,281
21년 전 조회 3,890
21년 전 조회 4,933
21년 전 조회 6,187
21년 전 조회 7,312
21년 전 조회 1.8만
21년 전 조회 6,855
21년 전 조회 2,858
21년 전 조회 4,112
21년 전 조회 2,464
21년 전 조회 4,285
21년 전 조회 2,876
21년 전 조회 2,230
21년 전 조회 2,449
21년 전 조회 2,209
21년 전 조회 2,542
21년 전 조회 1,716
21년 전 조회 1,554
21년 전 조회 1,608
21년 전 조회 2,100
21년 전 조회 1,855
21년 전 조회 2,357
21년 전 조회 3,548
21년 전 조회 1,546
21년 전 조회 1,741
21년 전 조회 3,154
21년 전 조회 2,329
21년 전 조회 3,156
21년 전 조회 2,859
21년 전 조회 3,284
21년 전 조회 5,100
21년 전 조회 2,504
21년 전 조회 4,799
21년 전 조회 2,481
21년 전 조회 3,094
21년 전 조회 7,600
21년 전 조회 3,808
21년 전 조회 3,192
21년 전 조회 4,678
21년 전 조회 2,878
21년 전 조회 6,206
21년 전 조회 4,462
21년 전 조회 5,768
21년 전 조회 3,614
21년 전 조회 5,947
21년 전 조회 3,093
21년 전 조회 2,816
21년 전 조회 2,609
21년 전 조회 2,418
21년 전 조회 2,624
21년 전 조회 2,654
21년 전 조회 3,776
21년 전 조회 2,797
21년 전 조회 2,442
🐛 버그신고