리자

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

· 21년 전 · 6337
<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,217
20년 전 조회 2,902
20년 전 조회 1,876
20년 전 조회 1,751
20년 전 조회 2,702
20년 전 조회 1,607
20년 전 조회 1,868
20년 전 조회 3,372
20년 전 조회 2,020
20년 전 조회 1,746
20년 전 조회 5,081
20년 전 조회 4,700
20년 전 조회 3,639
20년 전 조회 3,918
20년 전 조회 7,196
20년 전 조회 3,673
20년 전 조회 2,750
20년 전 조회 2,755
20년 전 조회 7,316
20년 전 조회 4,734
20년 전 조회 2,024
20년 전 조회 3,378
20년 전 조회 2,079
20년 전 조회 1,684
20년 전 조회 2,439
20년 전 조회 1,915
20년 전 조회 1,585
20년 전 조회 1,937
20년 전 조회 3,115
20년 전 조회 2,585
20년 전 조회 1,862
20년 전 조회 1,796
20년 전 조회 4,119
20년 전 조회 3,059
20년 전 조회 3,778
20년 전 조회 3,570
21년 전 조회 3,883
21년 전 조회 8,687
21년 전 조회 2,724
21년 전 조회 3,880
21년 전 조회 3,335
21년 전 조회 2,731
21년 전 조회 2,800
21년 전 조회 2,709
21년 전 조회 2,989
21년 전 조회 3,168
21년 전 조회 5,430
21년 전 조회 4,034
21년 전 조회 5,085
21년 전 조회 6,338
21년 전 조회 7,465
21년 전 조회 1.9만
21년 전 조회 7,020
21년 전 조회 3,011
21년 전 조회 4,276
21년 전 조회 2,613
21년 전 조회 4,446
21년 전 조회 3,030
21년 전 조회 2,377
21년 전 조회 2,602
21년 전 조회 2,359
21년 전 조회 2,688
21년 전 조회 1,871
21년 전 조회 1,697
21년 전 조회 1,773
21년 전 조회 2,241
21년 전 조회 2,005
21년 전 조회 2,502
21년 전 조회 3,696
21년 전 조회 1,702
21년 전 조회 1,901
21년 전 조회 3,310
21년 전 조회 2,489
21년 전 조회 3,294
21년 전 조회 3,013
21년 전 조회 3,434
21년 전 조회 5,252
21년 전 조회 2,660
21년 전 조회 4,950
21년 전 조회 2,642
21년 전 조회 3,246
21년 전 조회 7,742
21년 전 조회 3,963
21년 전 조회 3,347
21년 전 조회 4,835
21년 전 조회 3,035
21년 전 조회 6,366
21년 전 조회 4,616
21년 전 조회 5,915
21년 전 조회 3,761
21년 전 조회 6,108
21년 전 조회 3,255
21년 전 조회 2,961
21년 전 조회 2,764
21년 전 조회 2,570
21년 전 조회 2,782
21년 전 조회 2,809
21년 전 조회 3,925
21년 전 조회 2,959
21년 전 조회 2,593