리자

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

· 21년 전 · 6184
<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,055
20년 전 조회 2,756
20년 전 조회 1,715
20년 전 조회 1,587
20년 전 조회 2,538
20년 전 조회 1,458
20년 전 조회 1,705
20년 전 조회 3,206
20년 전 조회 1,858
20년 전 조회 1,585
20년 전 조회 4,914
20년 전 조회 4,551
20년 전 조회 3,492
20년 전 조회 3,757
20년 전 조회 7,039
20년 전 조회 3,527
20년 전 조회 2,594
20년 전 조회 2,586
20년 전 조회 7,147
20년 전 조회 4,561
20년 전 조회 1,869
20년 전 조회 3,228
20년 전 조회 1,927
20년 전 조회 1,529
20년 전 조회 2,277
20년 전 조회 1,763
20년 전 조회 1,436
20년 전 조회 1,777
20년 전 조회 2,950
20년 전 조회 2,422
20년 전 조회 1,702
20년 전 조회 1,628
20년 전 조회 3,958
20년 전 조회 2,899
20년 전 조회 3,618
20년 전 조회 3,413
20년 전 조회 3,719
20년 전 조회 8,548
20년 전 조회 2,571
20년 전 조회 3,728
20년 전 조회 3,178
20년 전 조회 2,577
20년 전 조회 2,645
20년 전 조회 2,556
20년 전 조회 2,836
21년 전 조회 3,015
21년 전 조회 5,279
21년 전 조회 3,886
21년 전 조회 4,931
21년 전 조회 6,185
21년 전 조회 7,310
21년 전 조회 1.8만
21년 전 조회 6,851
21년 전 조회 2,856
21년 전 조회 4,110
21년 전 조회 2,460
21년 전 조회 4,282
21년 전 조회 2,873
21년 전 조회 2,227
21년 전 조회 2,446
21년 전 조회 2,207
21년 전 조회 2,540
21년 전 조회 1,713
21년 전 조회 1,551
21년 전 조회 1,603
21년 전 조회 2,098
21년 전 조회 1,853
21년 전 조회 2,355
21년 전 조회 3,544
21년 전 조회 1,542
21년 전 조회 1,739
21년 전 조회 3,152
21년 전 조회 2,326
21년 전 조회 3,155
21년 전 조회 2,856
21년 전 조회 3,281
21년 전 조회 5,099
21년 전 조회 2,501
21년 전 조회 4,796
21년 전 조회 2,478
21년 전 조회 3,091
21년 전 조회 7,596
21년 전 조회 3,806
21년 전 조회 3,191
21년 전 조회 4,674
21년 전 조회 2,875
21년 전 조회 6,204
21년 전 조회 4,461
21년 전 조회 5,764
21년 전 조회 3,610
21년 전 조회 5,945
21년 전 조회 3,089
21년 전 조회 2,814
21년 전 조회 2,607
21년 전 조회 2,416
21년 전 조회 2,622
21년 전 조회 2,651
21년 전 조회 3,773
21년 전 조회 2,794
21년 전 조회 2,437
🐛 버그신고