리자

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

· 21년 전 · 6289
<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,162
20년 전 조회 2,860
20년 전 조회 1,824
20년 전 조회 1,702
20년 전 조회 2,656
20년 전 조회 1,565
20년 전 조회 1,823
20년 전 조회 3,317
20년 전 조회 1,973
20년 전 조회 1,697
20년 전 조회 5,029
20년 전 조회 4,657
20년 전 조회 3,597
20년 전 조회 3,870
20년 전 조회 7,150
20년 전 조회 3,628
20년 전 조회 2,705
20년 전 조회 2,703
20년 전 조회 7,268
20년 전 조회 4,680
20년 전 조회 1,981
20년 전 조회 3,336
20년 전 조회 2,029
20년 전 조회 1,641
20년 전 조회 2,390
20년 전 조회 1,871
20년 전 조회 1,540
20년 전 조회 1,893
20년 전 조회 3,066
20년 전 조회 2,528
20년 전 조회 1,819
20년 전 조회 1,745
20년 전 조회 4,072
20년 전 조회 3,008
20년 전 조회 3,730
20년 전 조회 3,518
21년 전 조회 3,833
21년 전 조회 8,641
21년 전 조회 2,675
21년 전 조회 3,831
21년 전 조회 3,287
21년 전 조회 2,687
21년 전 조회 2,755
21년 전 조회 2,666
21년 전 조회 2,949
21년 전 조회 3,118
21년 전 조회 5,384
21년 전 조회 3,988
21년 전 조회 5,032
21년 전 조회 6,290
21년 전 조회 7,422
21년 전 조회 1.9만
21년 전 조회 6,965
21년 전 조회 2,967
21년 전 조회 4,225
21년 전 조회 2,562
21년 전 조회 4,393
21년 전 조회 2,978
21년 전 조회 2,326
21년 전 조회 2,554
21년 전 조회 2,308
21년 전 조회 2,646
21년 전 조회 1,823
21년 전 조회 1,659
21년 전 조회 1,727
21년 전 조회 2,200
21년 전 조회 1,957
21년 전 조회 2,454
21년 전 조회 3,650
21년 전 조회 1,650
21년 전 조회 1,849
21년 전 조회 3,260
21년 전 조회 2,436
21년 전 조회 3,251
21년 전 조회 2,962
21년 전 조회 3,382
21년 전 조회 5,202
21년 전 조회 2,608
21년 전 조회 4,901
21년 전 조회 2,595
21년 전 조회 3,201
21년 전 조회 7,707
21년 전 조회 3,915
21년 전 조회 3,289
21년 전 조회 4,781
21년 전 조회 2,982
21년 전 조회 6,317
21년 전 조회 4,563
21년 전 조회 5,868
21년 전 조회 3,718
21년 전 조회 6,062
21년 전 조회 3,198
21년 전 조회 2,918
21년 전 조회 2,708
21년 전 조회 2,519
21년 전 조회 2,724
21년 전 조회 2,766
21년 전 조회 3,878
21년 전 조회 2,900
21년 전 조회 2,548