리자

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

· 21년 전 · 6391
<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,277
21년 전 조회 2,966
21년 전 조회 1,936
21년 전 조회 1,805
21년 전 조회 2,761
21년 전 조회 1,666
21년 전 조회 1,927
21년 전 조회 3,433
21년 전 조회 2,076
21년 전 조회 1,797
21년 전 조회 5,128
21년 전 조회 4,757
21년 전 조회 3,707
21년 전 조회 3,976
21년 전 조회 7,245
21년 전 조회 3,733
21년 전 조회 2,806
21년 전 조회 2,807
21년 전 조회 7,364
21년 전 조회 4,786
21년 전 조회 2,071
21년 전 조회 3,432
21년 전 조회 2,145
21년 전 조회 1,745
21년 전 조회 2,499
21년 전 조회 1,975
21년 전 조회 1,641
21년 전 조회 1,986
21년 전 조회 3,168
21년 전 조회 2,632
21년 전 조회 1,916
21년 전 조회 1,850
21년 전 조회 4,166
21년 전 조회 3,109
21년 전 조회 3,821
21년 전 조회 3,628
21년 전 조회 3,941
21년 전 조회 8,734
21년 전 조회 2,783
21년 전 조회 3,934
21년 전 조회 3,395
21년 전 조회 2,786
21년 전 조회 2,847
21년 전 조회 2,766
21년 전 조회 3,035
21년 전 조회 3,213
21년 전 조회 5,490
21년 전 조회 4,089
21년 전 조회 5,126
21년 전 조회 6,392
21년 전 조회 7,521
21년 전 조회 1.9만
21년 전 조회 7,060
21년 전 조회 3,066
21년 전 조회 4,317
21년 전 조회 2,667
21년 전 조회 4,490
21년 전 조회 3,075
21년 전 조회 2,425
21년 전 조회 2,640
21년 전 조회 2,399
21년 전 조회 2,730
21년 전 조회 1,914
21년 전 조회 1,758
21년 전 조회 1,835
21년 전 조회 2,299
21년 전 조회 2,053
21년 전 조회 2,560
21년 전 조회 3,745
21년 전 조회 1,763
21년 전 조회 1,966
21년 전 조회 3,360
21년 전 조회 2,535
21년 전 조회 3,361
21년 전 조회 3,063
21년 전 조회 3,487
21년 전 조회 5,306
21년 전 조회 2,706
21년 전 조회 5,007
21년 전 조회 2,686
21년 전 조회 3,290
21년 전 조회 7,784
21년 전 조회 4,003
21년 전 조회 3,397
21년 전 조회 4,881
21년 전 조회 3,078
21년 전 조회 6,416
21년 전 조회 4,658
21년 전 조회 5,965
21년 전 조회 3,801
21년 전 조회 6,159
21년 전 조회 3,296
21년 전 조회 3,015
21년 전 조회 2,813
21년 전 조회 2,622
21년 전 조회 2,831
21년 전 조회 2,855
21년 전 조회 3,984
21년 전 조회 3,012
21년 전 조회 2,646