리자

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

· 21년 전 · 6327
<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,214
20년 전 조회 2,897
20년 전 조회 1,866
20년 전 조회 1,741
20년 전 조회 2,697
20년 전 조회 1,601
20년 전 조회 1,855
20년 전 조회 3,361
20년 전 조회 2,018
20년 전 조회 1,736
20년 전 조회 5,072
20년 전 조회 4,696
20년 전 조회 3,633
20년 전 조회 3,909
20년 전 조회 7,188
20년 전 조회 3,668
20년 전 조회 2,740
20년 전 조회 2,747
20년 전 조회 7,310
20년 전 조회 4,724
20년 전 조회 2,018
20년 전 조회 3,371
20년 전 조회 2,075
20년 전 조회 1,678
20년 전 조회 2,429
20년 전 조회 1,910
20년 전 조회 1,577
20년 전 조회 1,930
20년 전 조회 3,105
20년 전 조회 2,574
20년 전 조회 1,853
20년 전 조회 1,785
20년 전 조회 4,111
20년 전 조회 3,054
20년 전 조회 3,772
20년 전 조회 3,564
21년 전 조회 3,880
21년 전 조회 8,687
21년 전 조회 2,719
21년 전 조회 3,876
21년 전 조회 3,329
21년 전 조회 2,723
21년 전 조회 2,793
21년 전 조회 2,703
21년 전 조회 2,981
21년 전 조회 3,158
21년 전 조회 5,429
21년 전 조회 4,024
21년 전 조회 5,077
21년 전 조회 6,328
21년 전 조회 7,457
21년 전 조회 1.9만
21년 전 조회 7,008
21년 전 조회 3,001
21년 전 조회 4,270
21년 전 조회 2,607
21년 전 조회 4,437
21년 전 조회 3,017
21년 전 조회 2,368
21년 전 조회 2,594
21년 전 조회 2,355
21년 전 조회 2,682
21년 전 조회 1,864
21년 전 조회 1,691
21년 전 조회 1,767
21년 전 조회 2,234
21년 전 조회 2,000
21년 전 조회 2,496
21년 전 조회 3,688
21년 전 조회 1,698
21년 전 조회 1,895
21년 전 조회 3,302
21년 전 조회 2,487
21년 전 조회 3,281
21년 전 조회 3,006
21년 전 조회 3,426
21년 전 조회 5,245
21년 전 조회 2,654
21년 전 조회 4,943
21년 전 조회 2,637
21년 전 조회 3,237
21년 전 조회 7,737
21년 전 조회 3,956
21년 전 조회 3,339
21년 전 조회 4,827
21년 전 조회 3,029
21년 전 조회 6,358
21년 전 조회 4,610
21년 전 조회 5,907
21년 전 조회 3,757
21년 전 조회 6,095
21년 전 조회 3,249
21년 전 조회 2,959
21년 전 조회 2,755
21년 전 조회 2,566
21년 전 조회 2,771
21년 전 조회 2,804
21년 전 조회 3,917
21년 전 조회 2,950
21년 전 조회 2,587