리자

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

· 21년 전 · 6277
<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,150
20년 전 조회 2,851
20년 전 조회 1,813
20년 전 조회 1,694
20년 전 조회 2,642
20년 전 조회 1,556
20년 전 조회 1,818
20년 전 조회 3,310
20년 전 조회 1,960
20년 전 조회 1,689
20년 전 조회 5,020
20년 전 조회 4,652
20년 전 조회 3,590
20년 전 조회 3,857
20년 전 조회 7,137
20년 전 조회 3,617
20년 전 조회 2,696
20년 전 조회 2,692
20년 전 조회 7,258
20년 전 조회 4,670
20년 전 조회 1,971
20년 전 조회 3,322
20년 전 조회 2,020
20년 전 조회 1,627
20년 전 조회 2,378
20년 전 조회 1,859
20년 전 조회 1,524
20년 전 조회 1,877
20년 전 조회 3,060
20년 전 조회 2,515
20년 전 조회 1,808
20년 전 조회 1,732
20년 전 조회 4,056
20년 전 조회 3,000
20년 전 조회 3,721
20년 전 조회 3,508
21년 전 조회 3,818
21년 전 조회 8,632
21년 전 조회 2,664
21년 전 조회 3,821
21년 전 조회 3,268
21년 전 조회 2,673
21년 전 조회 2,745
21년 전 조회 2,660
21년 전 조회 2,939
21년 전 조회 3,115
21년 전 조회 5,376
21년 전 조회 3,978
21년 전 조회 5,020
21년 전 조회 6,278
21년 전 조회 7,414
21년 전 조회 1.8만
21년 전 조회 6,949
21년 전 조회 2,956
21년 전 조회 4,209
21년 전 조회 2,551
21년 전 조회 4,380
21년 전 조회 2,968
21년 전 조회 2,315
21년 전 조회 2,544
21년 전 조회 2,294
21년 전 조회 2,634
21년 전 조회 1,810
21년 전 조회 1,643
21년 전 조회 1,709
21년 전 조회 2,190
21년 전 조회 1,942
21년 전 조회 2,444
21년 전 조회 3,632
21년 전 조회 1,637
21년 전 조회 1,835
21년 전 조회 3,252
21년 전 조회 2,425
21년 전 조회 3,241
21년 전 조회 2,952
21년 전 조회 3,372
21년 전 조회 5,192
21년 전 조회 2,599
21년 전 조회 4,890
21년 전 조회 2,584
21년 전 조회 3,188
21년 전 조회 7,693
21년 전 조회 3,900
21년 전 조회 3,278
21년 전 조회 4,766
21년 전 조회 2,972
21년 전 조회 6,302
21년 전 조회 4,555
21년 전 조회 5,858
21년 전 조회 3,708
21년 전 조회 6,047
21년 전 조회 3,182
21년 전 조회 2,905
21년 전 조회 2,693
21년 전 조회 2,510
21년 전 조회 2,712
21년 전 조회 2,749
21년 전 조회 3,865
21년 전 조회 2,887
21년 전 조회 2,533