리자

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

· 21년 전 · 6336
<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,216
20년 전 조회 2,901
20년 전 조회 1,870
20년 전 조회 1,750
20년 전 조회 2,700
20년 전 조회 1,605
20년 전 조회 1,866
20년 전 조회 3,369
20년 전 조회 2,020
20년 전 조회 1,744
20년 전 조회 5,078
20년 전 조회 4,700
20년 전 조회 3,637
20년 전 조회 3,917
20년 전 조회 7,194
20년 전 조회 3,673
20년 전 조회 2,745
20년 전 조회 2,755
20년 전 조회 7,315
20년 전 조회 4,730
20년 전 조회 2,022
20년 전 조회 3,375
20년 전 조회 2,077
20년 전 조회 1,682
20년 전 조회 2,434
20년 전 조회 1,915
20년 전 조회 1,583
20년 전 조회 1,936
20년 전 조회 3,114
20년 전 조회 2,583
20년 전 조회 1,861
20년 전 조회 1,793
20년 전 조회 4,118
20년 전 조회 3,058
20년 전 조회 3,776
20년 전 조회 3,569
21년 전 조회 3,883
21년 전 조회 8,687
21년 전 조회 2,723
21년 전 조회 3,879
21년 전 조회 3,333
21년 전 조회 2,730
21년 전 조회 2,796
21년 전 조회 2,709
21년 전 조회 2,986
21년 전 조회 3,166
21년 전 조회 5,430
21년 전 조회 4,031
21년 전 조회 5,084
21년 전 조회 6,337
21년 전 조회 7,463
21년 전 조회 1.9만
21년 전 조회 7,019
21년 전 조회 3,008
21년 전 조회 4,273
21년 전 조회 2,611
21년 전 조회 4,444
21년 전 조회 3,028
21년 전 조회 2,376
21년 전 조회 2,601
21년 전 조회 2,358
21년 전 조회 2,686
21년 전 조회 1,871
21년 전 조회 1,696
21년 전 조회 1,773
21년 전 조회 2,241
21년 전 조회 2,004
21년 전 조회 2,500
21년 전 조회 3,692
21년 전 조회 1,702
21년 전 조회 1,898
21년 전 조회 3,309
21년 전 조회 2,488
21년 전 조회 3,291
21년 전 조회 3,011
21년 전 조회 3,432
21년 전 조회 5,251
21년 전 조회 2,659
21년 전 조회 4,947
21년 전 조회 2,641
21년 전 조회 3,242
21년 전 조회 7,741
21년 전 조회 3,962
21년 전 조회 3,347
21년 전 조회 4,832
21년 전 조회 3,034
21년 전 조회 6,365
21년 전 조회 4,615
21년 전 조회 5,912
21년 전 조회 3,761
21년 전 조회 6,105
21년 전 조회 3,253
21년 전 조회 2,960
21년 전 조회 2,763
21년 전 조회 2,569
21년 전 조회 2,779
21년 전 조회 2,807
21년 전 조회 3,925
21년 전 조회 2,957
21년 전 조회 2,591