리자

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

· 21년 전 · 6191
<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,062
20년 전 조회 2,763
20년 전 조회 1,719
20년 전 조회 1,595
20년 전 조회 2,543
20년 전 조회 1,464
20년 전 조회 1,711
20년 전 조회 3,211
20년 전 조회 1,863
20년 전 조회 1,590
20년 전 조회 4,920
20년 전 조회 4,557
20년 전 조회 3,499
20년 전 조회 3,766
20년 전 조회 7,045
20년 전 조회 3,534
20년 전 조회 2,600
20년 전 조회 2,596
20년 전 조회 7,153
20년 전 조회 4,567
20년 전 조회 1,874
20년 전 조회 3,234
20년 전 조회 1,933
20년 전 조회 1,534
20년 전 조회 2,283
20년 전 조회 1,769
20년 전 조회 1,441
20년 전 조회 1,784
20년 전 조회 2,956
20년 전 조회 2,427
20년 전 조회 1,709
20년 전 조회 1,632
20년 전 조회 3,962
20년 전 조회 2,905
20년 전 조회 3,623
20년 전 조회 3,421
20년 전 조회 3,725
20년 전 조회 8,553
20년 전 조회 2,578
21년 전 조회 3,735
21년 전 조회 3,184
21년 전 조회 2,582
21년 전 조회 2,651
21년 전 조회 2,561
21년 전 조회 2,843
21년 전 조회 3,018
21년 전 조회 5,287
21년 전 조회 3,891
21년 전 조회 4,938
21년 전 조회 6,192
21년 전 조회 7,316
21년 전 조회 1.8만
21년 전 조회 6,860
21년 전 조회 2,863
21년 전 조회 4,117
21년 전 조회 2,464
21년 전 조회 4,289
21년 전 조회 2,881
21년 전 조회 2,234
21년 전 조회 2,452
21년 전 조회 2,212
21년 전 조회 2,546
21년 전 조회 1,718
21년 전 조회 1,557
21년 전 조회 1,611
21년 전 조회 2,103
21년 전 조회 1,858
21년 전 조회 2,361
21년 전 조회 3,551
21년 전 조회 1,549
21년 전 조회 1,744
21년 전 조회 3,156
21년 전 조회 2,333
21년 전 조회 3,160
21년 전 조회 2,864
21년 전 조회 3,286
21년 전 조회 5,104
21년 전 조회 2,508
21년 전 조회 4,803
21년 전 조회 2,484
21년 전 조회 3,095
21년 전 조회 7,603
21년 전 조회 3,809
21년 전 조회 3,195
21년 전 조회 4,680
21년 전 조회 2,882
21년 전 조회 6,212
21년 전 조회 4,467
21년 전 조회 5,770
21년 전 조회 3,615
21년 전 조회 5,951
21년 전 조회 3,094
21년 전 조회 2,820
21년 전 조회 2,613
21년 전 조회 2,420
21년 전 조회 2,629
21년 전 조회 2,658
21년 전 조회 3,778
21년 전 조회 2,801
21년 전 조회 2,444