리자

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

· 21년 전 · 6193
<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,065
20년 전 조회 2,768
20년 전 조회 1,724
20년 전 조회 1,595
20년 전 조회 2,545
20년 전 조회 1,467
20년 전 조회 1,713
20년 전 조회 3,215
20년 전 조회 1,867
20년 전 조회 1,594
20년 전 조회 4,925
20년 전 조회 4,561
20년 전 조회 3,501
20년 전 조회 3,770
20년 전 조회 7,047
20년 전 조회 3,537
20년 전 조회 2,602
20년 전 조회 2,598
20년 전 조회 7,155
20년 전 조회 4,570
20년 전 조회 1,876
20년 전 조회 3,236
20년 전 조회 1,935
20년 전 조회 1,539
20년 전 조회 2,287
20년 전 조회 1,774
20년 전 조회 1,447
20년 전 조회 1,787
20년 전 조회 2,957
20년 전 조회 2,432
20년 전 조회 1,711
20년 전 조회 1,636
20년 전 조회 3,965
20년 전 조회 2,907
20년 전 조회 3,629
20년 전 조회 3,423
20년 전 조회 3,729
20년 전 조회 8,556
20년 전 조회 2,580
21년 전 조회 3,737
21년 전 조회 3,185
21년 전 조회 2,585
21년 전 조회 2,654
21년 전 조회 2,565
21년 전 조회 2,845
21년 전 조회 3,020
21년 전 조회 5,289
21년 전 조회 3,892
21년 전 조회 4,939
21년 전 조회 6,194
21년 전 조회 7,319
21년 전 조회 1.8만
21년 전 조회 6,861
21년 전 조회 2,865
21년 전 조회 4,121
21년 전 조회 2,467
21년 전 조회 4,292
21년 전 조회 2,883
21년 전 조회 2,239
21년 전 조회 2,455
21년 전 조회 2,215
21년 전 조회 2,549
21년 전 조회 1,723
21년 전 조회 1,561
21년 전 조회 1,613
21년 전 조회 2,105
21년 전 조회 1,860
21년 전 조회 2,366
21년 전 조회 3,553
21년 전 조회 1,552
21년 전 조회 1,750
21년 전 조회 3,160
21년 전 조회 2,337
21년 전 조회 3,163
21년 전 조회 2,867
21년 전 조회 3,291
21년 전 조회 5,107
21년 전 조회 2,511
21년 전 조회 4,806
21년 전 조회 2,486
21년 전 조회 3,097
21년 전 조회 7,606
21년 전 조회 3,812
21년 전 조회 3,200
21년 전 조회 4,685
21년 전 조회 2,885
21년 전 조회 6,216
21년 전 조회 4,468
21년 전 조회 5,772
21년 전 조회 3,618
21년 전 조회 5,954
21년 전 조회 3,099
21년 전 조회 2,823
21년 전 조회 2,614
21년 전 조회 2,421
21년 전 조회 2,632
21년 전 조회 2,661
21년 전 조회 3,781
21년 전 조회 2,802
21년 전 조회 2,448