리자

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

· 21년 전 · 6288
<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,161
20년 전 조회 2,859
20년 전 조회 1,823
20년 전 조회 1,702
20년 전 조회 2,655
20년 전 조회 1,563
20년 전 조회 1,823
20년 전 조회 3,316
20년 전 조회 1,972
20년 전 조회 1,697
20년 전 조회 5,029
20년 전 조회 4,657
20년 전 조회 3,596
20년 전 조회 3,870
20년 전 조회 7,150
20년 전 조회 3,627
20년 전 조회 2,705
20년 전 조회 2,703
20년 전 조회 7,268
20년 전 조회 4,680
20년 전 조회 1,980
20년 전 조회 3,336
20년 전 조회 2,027
20년 전 조회 1,641
20년 전 조회 2,390
20년 전 조회 1,870
20년 전 조회 1,538
20년 전 조회 1,892
20년 전 조회 3,066
20년 전 조회 2,526
20년 전 조회 1,818
20년 전 조회 1,745
20년 전 조회 4,071
20년 전 조회 3,008
20년 전 조회 3,730
20년 전 조회 3,517
21년 전 조회 3,832
21년 전 조회 8,640
21년 전 조회 2,674
21년 전 조회 3,830
21년 전 조회 3,287
21년 전 조회 2,687
21년 전 조회 2,755
21년 전 조회 2,665
21년 전 조회 2,948
21년 전 조회 3,118
21년 전 조회 5,384
21년 전 조회 3,986
21년 전 조회 5,032
21년 전 조회 6,289
21년 전 조회 7,422
21년 전 조회 1.9만
21년 전 조회 6,965
21년 전 조회 2,967
21년 전 조회 4,224
21년 전 조회 2,562
21년 전 조회 4,393
21년 전 조회 2,977
21년 전 조회 2,326
21년 전 조회 2,554
21년 전 조회 2,307
21년 전 조회 2,646
21년 전 조회 1,823
21년 전 조회 1,659
21년 전 조회 1,725
21년 전 조회 2,200
21년 전 조회 1,957
21년 전 조회 2,454
21년 전 조회 3,650
21년 전 조회 1,650
21년 전 조회 1,848
21년 전 조회 3,260
21년 전 조회 2,436
21년 전 조회 3,250
21년 전 조회 2,961
21년 전 조회 3,382
21년 전 조회 5,201
21년 전 조회 2,607
21년 전 조회 4,900
21년 전 조회 2,595
21년 전 조회 3,201
21년 전 조회 7,706
21년 전 조회 3,915
21년 전 조회 3,289
21년 전 조회 4,781
21년 전 조회 2,982
21년 전 조회 6,317
21년 전 조회 4,563
21년 전 조회 5,867
21년 전 조회 3,718
21년 전 조회 6,061
21년 전 조회 3,195
21년 전 조회 2,915
21년 전 조회 2,707
21년 전 조회 2,518
21년 전 조회 2,724
21년 전 조회 2,763
21년 전 조회 3,878
21년 전 조회 2,900
21년 전 조회 2,547