리자

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

· 21년 전 · 6183
<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,755
20년 전 조회 1,713
20년 전 조회 1,584
20년 전 조회 2,535
20년 전 조회 1,457
20년 전 조회 1,704
20년 전 조회 3,205
20년 전 조회 1,857
20년 전 조회 1,585
20년 전 조회 4,913
20년 전 조회 4,548
20년 전 조회 3,490
20년 전 조회 3,756
20년 전 조회 7,039
20년 전 조회 3,526
20년 전 조회 2,594
20년 전 조회 2,585
20년 전 조회 7,146
20년 전 조회 4,560
20년 전 조회 1,868
20년 전 조회 3,227
20년 전 조회 1,926
20년 전 조회 1,529
20년 전 조회 2,276
20년 전 조회 1,763
20년 전 조회 1,436
20년 전 조회 1,777
20년 전 조회 2,949
20년 전 조회 2,420
20년 전 조회 1,701
20년 전 조회 1,627
20년 전 조회 3,956
20년 전 조회 2,898
20년 전 조회 3,616
20년 전 조회 3,412
20년 전 조회 3,717
20년 전 조회 8,547
20년 전 조회 2,570
20년 전 조회 3,726
20년 전 조회 3,177
20년 전 조회 2,575
20년 전 조회 2,644
20년 전 조회 2,555
20년 전 조회 2,834
21년 전 조회 3,014
21년 전 조회 5,278
21년 전 조회 3,885
21년 전 조회 4,930
21년 전 조회 6,184
21년 전 조회 7,309
21년 전 조회 1.8만
21년 전 조회 6,850
21년 전 조회 2,854
21년 전 조회 4,109
21년 전 조회 2,459
21년 전 조회 4,281
21년 전 조회 2,872
21년 전 조회 2,226
21년 전 조회 2,445
21년 전 조회 2,206
21년 전 조회 2,539
21년 전 조회 1,712
21년 전 조회 1,549
21년 전 조회 1,602
21년 전 조회 2,095
21년 전 조회 1,852
21년 전 조회 2,354
21년 전 조회 3,544
21년 전 조회 1,541
21년 전 조회 1,738
21년 전 조회 3,150
21년 전 조회 2,325
21년 전 조회 3,152
21년 전 조회 2,855
21년 전 조회 3,281
21년 전 조회 5,097
21년 전 조회 2,499
21년 전 조회 4,795
21년 전 조회 2,477
21년 전 조회 3,089
21년 전 조회 7,596
21년 전 조회 3,805
21년 전 조회 3,190
21년 전 조회 4,673
21년 전 조회 2,875
21년 전 조회 6,203
21년 전 조회 4,460
21년 전 조회 5,764
21년 전 조회 3,609
21년 전 조회 5,944
21년 전 조회 3,088
21년 전 조회 2,813
21년 전 조회 2,605
21년 전 조회 2,414
21년 전 조회 2,622
21년 전 조회 2,650
21년 전 조회 3,772
21년 전 조회 2,793
21년 전 조회 2,436
🐛 버그신고