리자

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

· 21년 전 · 6214
<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,089
20년 전 조회 2,789
20년 전 조회 1,743
20년 전 조회 1,627
20년 전 조회 2,569
20년 전 조회 1,487
20년 전 조회 1,738
20년 전 조회 3,238
20년 전 조회 1,889
20년 전 조회 1,616
20년 전 조회 4,947
20년 전 조회 4,584
20년 전 조회 3,517
20년 전 조회 3,788
20년 전 조회 7,067
20년 전 조회 3,556
20년 전 조회 2,621
20년 전 조회 2,619
20년 전 조회 7,183
20년 전 조회 4,590
20년 전 조회 1,899
20년 전 조회 3,250
20년 전 조회 1,955
20년 전 조회 1,556
20년 전 조회 2,309
20년 전 조회 1,789
20년 전 조회 1,458
20년 전 조회 1,805
20년 전 조회 2,982
20년 전 조회 2,450
20년 전 조회 1,739
20년 전 조회 1,658
20년 전 조회 3,991
20년 전 조회 2,930
20년 전 조회 3,653
20년 전 조회 3,443
20년 전 조회 3,750
20년 전 조회 8,576
20년 전 조회 2,595
21년 전 조회 3,751
21년 전 조회 3,207
21년 전 조회 2,602
21년 전 조회 2,674
21년 전 조회 2,591
21년 전 조회 2,866
21년 전 조회 3,043
21년 전 조회 5,303
21년 전 조회 3,912
21년 전 조회 4,960
21년 전 조회 6,215
21년 전 조회 7,344
21년 전 조회 1.8만
21년 전 조회 6,885
21년 전 조회 2,888
21년 전 조회 4,143
21년 전 조회 2,486
21년 전 조회 4,314
21년 전 조회 2,896
21년 전 조회 2,254
21년 전 조회 2,469
21년 전 조회 2,232
21년 전 조회 2,567
21년 전 조회 1,738
21년 전 조회 1,577
21년 전 조회 1,631
21년 전 조회 2,124
21년 전 조회 1,883
21년 전 조회 2,380
21년 전 조회 3,573
21년 전 조회 1,573
21년 전 조회 1,765
21년 전 조회 3,184
21년 전 조회 2,350
21년 전 조회 3,176
21년 전 조회 2,889
21년 전 조회 3,310
21년 전 조회 5,129
21년 전 조회 2,527
21년 전 조회 4,821
21년 전 조회 2,508
21년 전 조회 3,116
21년 전 조회 7,625
21년 전 조회 3,832
21년 전 조회 3,216
21년 전 조회 4,708
21년 전 조회 2,899
21년 전 조회 6,232
21년 전 조회 4,487
21년 전 조회 5,790
21년 전 조회 3,640
21년 전 조회 5,971
21년 전 조회 3,118
21년 전 조회 2,836
21년 전 조회 2,628
21년 전 조회 2,439
21년 전 조회 2,646
21년 전 조회 2,678
21년 전 조회 3,796
21년 전 조회 2,820
21년 전 조회 2,471