셀렉트 박스 내용을 레이어로 표현

· 17년 전 · 2555

<HTML>
<HEAD>
    <TITLE>http://www.blueb.co.kr</TITLE>
<script>

//SELECT -> LAYER변환
function getSelectToLayer(obj,lwidth,href)
{
    if(navigator.userAgent.indexOf('Opera') != -1 || navigator.userAgent.indexOf('MSIE') == -1) { return false; }

    obj.style.display = 'none';
    var newsb = obj.id + "_sbj";
    var newid = obj.id + "_tmp";
    var newim = obj.id + "_img";
    var LayerTag = "";

    LayerTag += "<TABLE WIDTH='"+lwidth+"' CELLSPACING=0 CELLPADDING=0 STYLE='position:absolute;cursor:default;'>";
    LayerTag += "<TR HEIGHT=1><TD></TD></TR><TR><TD>";
    LayerTag += "<TABLE BGCOLOR='#FFFFFF' HEIGHT=15 WIDTH=100% CELLSPACING=1 CELLPADDING=0 STYLE='border:1 solid #C0C0C0;line-height:117%;' onmouseover=\"getSelectLayerOver(this,document.getElementById('"+newim+"'),document.getElementById('"+newid+"'));\" onmouseout=\"getSelectLayerOut(this,document.getElementById('"+newim+"'),document.getElementById('"+newid+"'));\">";
   
    LayerTag += "<TR WIDTH=100% onclick=\"getSelectSubLayer(document.getElementById('"+newid+"'),document.getElementById('"+newsb+"'));\">";
    LayerTag += "<TD ID='"+newsb+"' WIDTH=95% onblur='getSelectLayerBlur(this);'> " + obj.options[obj.selectedIndex].text + "</TD>";
    LayerTag += "<TD ALIGN=RIGHT><IMG ID='"+newim+"' SRC='http://www.blueb.co.kr/image/ico/dot_select.gif' ALIGN=absmiddle STYLE='filter:gray();'></TD></TR>";
   
    LayerTag += "</TABLE>";

    LayerTag += "<TABLE onblur='getSubLayerClose(this);' ID='"+newid+"' WIDTH=100% CELLSPACING=0 CELLPADDING=0 STYLE='display:none;border:1 solid #C0C0C0;' BGCOLOR='#FFFFFF'>";
    for (var i = 0 ; i < obj.length; i++)
    {
        LayerTag += "<TR onmouseover='getSelectMoveLayer(this);' onmouseout='getSelectMoveLayer1(this);' onclick=\"getSelectChangeLayer(document.getElementById('"+obj.id+"'),document.getElementById('"+newid+"'),document.getElementById('"+newsb+"'),'"+obj.options[i].text+"','"+obj.options[i].value+"','"+href+"');\" ";

        if (obj.value == obj.options[i].value)
        {
            LayerTag += "STYLE='background:#225588;color:#FFFFFF;'><TD> ";
        }
        else {
            LayerTag += "STYLE='background:#FFFFFF;color:#000000;'><TD> ";
        }

        LayerTag += obj.options[i].text;
        LayerTag += "</TD></TR>";
    }
    LayerTag += "</TABLE>";
    LayerTag += "</TD></TR></TABLE><IMG SRC='' WIDTH='"+lwidth+"' HEIGHT=0>";

    document.write(LayerTag);
}

//서브레이어보이기
function getSelectSubLayer(obj,sobj)
{
    if(obj.style.display == 'none')
    {
        sobj.style.background = '#FFFFFF';
        sobj.style.color = '#000000';   
        obj.style.display = 'block';
        NowSelectedLayer = obj;
        obj.focus();
    }
    else {
        sobj.style.background = '#225588';
        sobj.style.color = '#FFFFFF';
        obj.style.display = 'none';
    }
}

//서브레이어체크
function getSelectSubLayer1(obj)
{
    if(obj.style.display != 'none')
    {
        obj.style.display = 'none';
    }
}

//타이틀레이어 MouseOver
function getSelectLayerOver(obj,img,nobj)
{
    if (nobj.style.display == 'none')
    {
        obj.style.border = '1 solid #225588';
        img.style.filter = '';
    }
}

//타이틀레이어 MouseOut
function getSelectLayerOut(obj,img)
{
    obj.style.border = '1 solid #C0C0C0';
    img.style.filter = 'gray()';
}


//서브레이어 MouseOver
function getSelectMoveLayer(obj)
{
    if (obj.style.color == '#000000')
    {
        obj.style.background = '#225588';
        obj.style.color = '#FFFFFF';
    }
}
//서브레이어 MouseOut
function getSelectMoveLayer1(obj)
{
    obj.style.background = '#FFFFFF';
    obj.style.color = '#000000';
}

//새레이어선택
function getSelectChangeLayer(obj,fobj,sobj,text,value,href)
{
    if (href)
    {
        eval("document.DataForm." + href).value = value;
        location.href = getThisUrl();
        return false;
    }
    else {
        fobj.style.display = 'none';
        sobj.innerHTML = ' ' + text;
        sobj.style.background = '#225588';
        sobj.style.color = '#FFFFFF';
        sobj.focus();
        obj.value = value;
    }
}

//타이틀레이어 blur
function getSelectLayerBlur(obj)
{
    obj.style.background = '#FFFFFF';
    obj.style.color = '#000000';
}

//서브레이어 닫기
function getSubLayerClose(obj)
{
    if (obj.style.display != 'none')
    {
        setTimeout("document.getElementById('" + obj.id + "').style.display = 'none';" , 150);
    }
}


</script>
</HEAD>

<BODY>
<SELECT ID='search_where'>
<OPTION VALUE="ALL">전체에서</OPTION>
<OPTION VALUE="BB_SUBJECT">제목</OPTION>
<OPTION VALUE="BB_Source">Source</OPTION>
<OPTION VALUE="BB_CONTENT">본문</OPTION>
<script language=javascript>getSelectToLayer(document.getElementById('search_where'),80,''); //검색영역select->layer변환</script>

</SELECT>
</BODY>
</HTML>

[이 게시물은 관리자님에 의해 2011-10-31 17:16:08 PHP & HTML에서 이동 됨]
|
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

+
제목 글쓴이 날짜 조회
17년 전 조회 3,588
17년 전 조회 3,529
17년 전 조회 2,718
17년 전 조회 4,115
17년 전 조회 3,551
17년 전 조회 5,856
17년 전 조회 3,018
17년 전 조회 2,217
17년 전 조회 2,299
17년 전 조회 2,133
17년 전 조회 2,080
17년 전 조회 3,140
17년 전 조회 2,251
17년 전 조회 1,905
17년 전 조회 2,437
17년 전 조회 1,474
17년 전 조회 2,038
17년 전 조회 3,265
17년 전 조회 2,509
17년 전 조회 2,153
17년 전 조회 2,376
17년 전 조회 1,695
17년 전 조회 2,095
17년 전 조회 1,590
17년 전 조회 2,115
17년 전 조회 2,152
17년 전 조회 1,395
17년 전 조회 3,487
17년 전 조회 4,668
17년 전 조회 2,816
17년 전 조회 7,834
17년 전 조회 4,193
17년 전 조회 4,514
17년 전 조회 2,765
17년 전 조회 3,272
17년 전 조회 4,001
17년 전 조회 4,342
17년 전 조회 3,524
17년 전 조회 3,529
17년 전 조회 3,652
17년 전 조회 2,798
17년 전 조회 2,408
17년 전 조회 3,453
17년 전 조회 3,624
17년 전 조회 4,943
17년 전 조회 1,950
17년 전 조회 2,963
17년 전 조회 3,050
17년 전 조회 2,270
17년 전 조회 2,556
17년 전 조회 2,187
17년 전 조회 2,750
17년 전 조회 4,152
17년 전 조회 4,229
17년 전 조회 2,441
17년 전 조회 1,686
17년 전 조회 1,819
17년 전 조회 1,980
17년 전 조회 1,955
17년 전 조회 1,714
17년 전 조회 1,858
17년 전 조회 1,679
17년 전 조회 2,171
17년 전 조회 3,103
17년 전 조회 2,180
17년 전 조회 1,724
17년 전 조회 2,028
17년 전 조회 2,676
17년 전 조회 2,287
17년 전 조회 1,590
17년 전 조회 6,233
17년 전 조회 3,606
17년 전 조회 3,527
17년 전 조회 2,905
17년 전 조회 3,110
17년 전 조회 3,065
17년 전 조회 3,577
17년 전 조회 2,705
17년 전 조회 2,812
17년 전 조회 2,868
17년 전 조회 2,860
17년 전 조회 3,000
17년 전 조회 3,546
17년 전 조회 3,028
17년 전 조회 1,767
17년 전 조회 3,192
17년 전 조회 1,908
17년 전 조회 1,672
17년 전 조회 2,338
17년 전 조회 1,790
17년 전 조회 1,732
17년 전 조회 1,655
17년 전 조회 1,883
17년 전 조회 2,378
17년 전 조회 1,747
17년 전 조회 1,726
17년 전 조회 1,545
17년 전 조회 1,762
17년 전 조회 1,501
17년 전 조회 1,632