리자

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

· 21년 전 · 6361
<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>
|
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

+
제목 글쓴이 날짜 조회
21년 전 조회 2,242
21년 전 조회 2,929
21년 전 조회 1,899
21년 전 조회 1,775
21년 전 조회 2,732
21년 전 조회 1,638
21년 전 조회 1,894
21년 전 조회 3,399
21년 전 조회 2,048
21년 전 조회 1,772
21년 전 조회 5,103
21년 전 조회 4,723
21년 전 조회 3,667
21년 전 조회 3,953
21년 전 조회 7,223
21년 전 조회 3,703
21년 전 조회 2,782
21년 전 조회 2,782
21년 전 조회 7,340
21년 전 조회 4,756
21년 전 조회 2,049
21년 전 조회 3,395
21년 전 조회 2,111
21년 전 조회 1,716
21년 전 조회 2,468
21년 전 조회 1,948
21년 전 조회 1,612
21년 전 조회 1,964
21년 전 조회 3,135
21년 전 조회 2,607
21년 전 조회 1,889
21년 전 조회 1,822
21년 전 조회 4,139
21년 전 조회 3,082
21년 전 조회 3,797
21년 전 조회 3,599
21년 전 조회 3,917
21년 전 조회 8,710
21년 전 조회 2,753
21년 전 조회 3,906
21년 전 조회 3,361
21년 전 조회 2,756
21년 전 조회 2,817
21년 전 조회 2,736
21년 전 조회 3,009
21년 전 조회 3,192
21년 전 조회 5,460
21년 전 조회 4,063
21년 전 조회 5,107
21년 전 조회 6,362
21년 전 조회 7,491
21년 전 조회 1.9만
21년 전 조회 7,046
21년 전 조회 3,033
21년 전 조회 4,296
21년 전 조회 2,638
21년 전 조회 4,465
21년 전 조회 3,040
21년 전 조회 2,403
21년 전 조회 2,619
21년 전 조회 2,378
21년 전 조회 2,710
21년 전 조회 1,893
21년 전 조회 1,731
21년 전 조회 1,803
21년 전 조회 2,269
21년 전 조회 2,029
21년 전 조회 2,533
21년 전 조회 3,725
21년 전 조회 1,726
21년 전 조회 1,938
21년 전 조회 3,335
21년 전 조회 2,510
21년 전 조회 3,329
21년 전 조회 3,034
21년 전 조회 3,452
21년 전 조회 5,276
21년 전 조회 2,678
21년 전 조회 4,979
21년 전 조회 2,667
21년 전 조회 3,265
21년 전 조회 7,764
21년 전 조회 3,985
21년 전 조회 3,367
21년 전 조회 4,854
21년 전 조회 3,050
21년 전 조회 6,386
21년 전 조회 4,640
21년 전 조회 5,945
21년 전 조회 3,784
21년 전 조회 6,132
21년 전 조회 3,275
21년 전 조회 2,985
21년 전 조회 2,788
21년 전 조회 2,596
21년 전 조회 2,810
21년 전 조회 2,831
21년 전 조회 3,952
21년 전 조회 2,987
21년 전 조회 2,619