네이버에서 제공하고 있는 도량형 계산 (단위 변환) > script

본문 바로가기
사이트 내 전체검색

script

네이버에서 제공하고 있는 도량형 계산 (단위 변환)

페이지 정보

작성자 서방님 댓글 0건 조회 83회 작성일 07-08-11 19:54

본문

<script>
/*
*     File Name : NSelect.js
*    
*    by franksop
*/

var UserAgent = navigator.userAgent;
var AppVersion = (((navigator.appVersion.split('; '))[1].split(' '))[1]);

// default NSelect style
var SL_ActiveIDX = null;
var SL_Focused = null;
var SL_FocusedIDX = null;
var SL_Table = " cellspacing=0 cellpadding=0 border=0";
var SL_Text = "text-indent:2px;padding-top:3px;";
var SL_IPrefix = "http://sstatic.naver.com/search/images5/";
var SL_AImage = "arrow.gif";
var SL_BImage = "blank.gif";
var SL_SBLen = 10;
var SL_SBWidth = 18;
var SL_ScrollBar = ""
    +"scrollbar-face-color:#ffffff;"
    +"scrollbar-shadow-color:999999;"
    +"scrollbar-highlight-color:#E8E8E8;"
    +"scrollbar-3dlight-color:999999;"
    +"scrollbar-darkshadow-color:#EEEEEE;"
    +"scrollbar-track-color:#999999;"
    +"scrollbar-arrow-color:#E8E8E8;";

var SL_BGColor = "#FEFFCB";
var SL_BGColor_M = "#225688";
var SL_Border = "1px solid #AFB086";
var SL_FontSize = "10pt";
var SL_FontColor = "#000000";
var SL_Height = "18px";

SList = new Array();
document.write( "<div id=NSDiv style='position:absolute;top:-100px;z-index:3;'></div>" );

// set SL Style
function setEnv( pSrc, pBG, pBM, pBD, pAI )
{
    var oEnv = new Object();
    var oSrc = createObject( pSrc );

    if( oSrc.style.width ) {
    oEnv.Width = oSrc.style.width;
    } else {
    document.all.NSDiv.innerHTML = ""
        +"<table style='top:2px;'><tr><td height=1>"+pSrc+"</td></tr></table>";
    oEnv.Width = document.all.NSDiv.scrollWidth;
    }
    if( oSrc.style.height ) oEnv.Height = oSrc.style.height; else oEnv.Height = SL_Height;
    if( oSrc.style.fontSize ) oEnv.FontSize = oSrc.style.fontSize; else oEnv.FontSize = SL_FontSize;
    if( oSrc.style.color ) oEnv.FontColor = oSrc.style.color; else oEnv.FontColor = SL_FontColor;

    if( pBG ) oEnv.BGColor = pBG;    else oEnv.BGColor = SL_BGColor;
    if( pBM ) oEnv.BGColor_M = pBM;    else oEnv.BGColor_M = SL_BGColor_M;
    if( pBD ) oEnv.Border = pBD;    else oEnv.Border = SL_Border;
    if( pAI ) oEnv.AImage = pAI;    else oEnv.AImage = SL_AImage;

    return oEnv;
}

// parameter NSelect
function NSelect( HTMLSrc, KIN, BG, BM, BD, AI )
{
    if ( UserAgent.indexOf( "MSIE" ) < 0 || AppVersion < 5 ) {
    document.write( HTMLSrc );
    return;
    } else {
    var SE = setEnv( HTMLSrc, BG, BM, BD, AI );
    var SListObj = new setNSelect( HTMLSrc, KIN, SE );
    SListObj.append();

    return SListObj;
    }
}

function appendSList()
{
    document.write("<div id=TempDiv></div>n");
    document.all.TempDiv.appendChild( this.Table );
    document.all.TempDiv.removeNode();

    return;
}

function MouseScrollHandler() {
    var f_titleObj = SList[SL_FocusedIDX].Title;
    var f_itemObj = SList[SL_FocusedIDX].Items;
    var idx_length = f_itemObj.options.length;
    var idx_selected = f_itemObj.options.selectedIndex ;

    CancelEventHandler( window.event );

    if( window.event.wheelDelta > 0 ) {
    idx_selected = Math.max( 0, --idx_selected );
    } else {
    idx_selected = Math.min( idx_length - 1, ++idx_selected );
    }

    if( f_itemObj.options.selectedIndex != idx_selected ) {
    f_itemObj.options.selectedIndex = idx_selected;
    SList[SL_FocusedIDX].ChangeTitle();
    if( f_itemObj.onchange ) f_itemObj.onchange();
    }

    return;
}

function ActiveIDXHandler() {
    if( SL_ActiveIDX == null ) {
    for( i = 0; i < SList.length; i++ ) {
        SList[i].List.style.display = "none";
        if( i == SL_Focused ) TitleHighlightHandler( i, 1 );
        else TitleHighlightHandler( i, 0 );
    }

    if( SL_Focused == null )
        document.detachEvent( 'onclick', ActiveIDXHandler );
    }
    if( SL_Focused == null ) document.detachEvent( 'onmousewheel', MouseScrollHandler );
    else document.attachEvent( 'onmousewheel', MouseScrollHandler );

    SL_ActiveIDX = null;
    SL_Focused = null;

    return;
}

function TitleClickHandler()
{
    SL_ActiveIDX = this.entry;

    for( i = 0; i < SList.length; i++ ) {
    if( i == SL_ActiveIDX ) {
        if( SList[i].List.style.display == "block" ) {
        SList[i].List.style.display = "none";
        TitleHighlightHandler( i, 1 );
        SL_Focused = i;
        SL_FocusedIDX = i;
        } else SList[i].List.style.display = "block";
    } else {
        SList[i].List.style.display = "none";
        TitleHighlightHandler( i, 0 );
    }
    }

    document.detachEvent( 'onclick', ActiveIDXHandler );
    document.attachEvent( 'onclick', ActiveIDXHandler );

    return;
}

function TitleMouseOverHandler()
{
    this.Title.children(0).cells(2).children(0).style.filter = "";
    if( !this.kin ) this.Title.style.border = "1 solid #999999";

    return;
}

function TitleMouseOutHandler()
{
    this.Title.children(0).cells(2).children(0).style.filter = "alpha( opacity=80 );";
    if( !this.kin ) this.Title.style.border = "1 solid #C3CACD";

    return;
}

function TitleHighlightHandler( entry, t )
{
    if( t ) {
    if( this.kin )
        SList[entry].Title.children(0).cells(0).style.background = SList[entry].env.BGColor;
    else
        SList[entry].Title.children(0).cells(0).style.background = SList[entry].env.BGColor_M;
    } else {
    SList[entry].Title.children(0).cells(0).style.background = SList[entry].env.BGColor;
    }

    return;
}

function ListMouseDownHandler( f )
{
    var tObj = this.Title.children(0);
    var length = this.Items.length;

    for( i = 0; i < length; i++ ) {
    this.Items.options[i].selected = false;
    if ( i == f.idx ) {
        this.Items.options[i].selected = true;
        this.ChangeTitle();
    }
    }
    if( this.Items.onchange ) this.Items.onchange();
    if ( this.kin && ( length - 1 ) == f.idx )
    location.href = this.Items.options[f.idx].value;

    this.List.style.display = "none";

    SL_Focused = this.entry;
    SL_FocusedIDX = this.entry;

    return;
}

function ListMouseOverHandler( f )
{
    if( this.kin ) f.style.color = "#FFFFFF";
    f.style.background = this.env.BGColor_M;
    return;
}

function ListMouseOutHandler( f )
{
    f.style.color = this.env.FontColor;
    f.style.background = this.env.BGColor;
    return;
}

function CancelEventHandler( e )
{
    e.cancelBubble = true;
    e.returnValue = false;

    return;
}

function ModifyDivHandler() {
    var width = parseInt( this.Title.style.width );

    this.Items.style.width = null;
    document.all.NSDiv.innerHTML = ""
    +"<table style='top:2px;'><tr><td height=1>"+this.Items.outerHTML+"</td></tr></table>";
    var scrollWidth = parseInt( document.all.NSDiv.scrollWidth );

    if( scrollWidth > width ) {
    this.Title.style.width = scrollWidth;
    this.List.style.width = scrollWidth;
    }

    return;
}

function ChangeTitleHandler() {
    var newTitle = this.Items.options[this.Items.options.selectedIndex].innerHTML ;
    this.Title.children(0).cells(0).innerHTML = "<nobr>"+newTitle+"</nobr>";

    return;
}

function ChangeListHandler() {
    var length = this.Items.length;
    var item = "";

    var listHeight = parseInt( this.env.Height ) * Math.min( SL_SBLen, length ) + 2;
    var overflowY = ( length > SL_SBLen ) ? "scroll" : "hidden";

    this.List.innerHTML = "";
    for( i = 0; i < this.Items.options.length; i++ ) {
    item = ""
        +"<DIV idx="+i+" style='height:"+this.env.Height+";"+SL_Text+"'"
        +"  onMouseDown='SList["+this.entry+"].ListMouseDown( this );'"
        +"  onMouseOver='SList["+this.entry+"].ListMouseOver( this );'"
        +"  onMouseOut='SList["+this.entry+"].ListMouseOut( this );'>"
        +"    <nobr>"+this.Items.options[i].innerText+"</nobr>"
        +"</DIV>";
    oItem = createObject( item );
    this.List.appendChild( oItem );
    }

    this.List.style.height = listHeight;
    this.List.style.overflowY = overflowY;

    return;
}

function AddOptionHandler( sText, sValue, iIndex ) {
    var oOption = document.createElement("OPTION");
    this.Items.options.add(oOption, iIndex);

    oOption.innerText = sText;
    oOption.value = sValue;

    return;
}

function setNSelect( pSrc, pKIN, pSE )
{
    this.entry = SList.length;
    this.lower = null;
    this.src = pSrc;
    this.env = pSE;
    this.kin = pKIN;

    // NSelect Object
    this.Items;
    this.Title;
    this.List;
    this.Table;

    // Create NSelect Element
    this.ItemObj = createObject;
    this.ListObj  = createList;
    this.TitleObj = createTitle;
    this.TableObj = createSList;

    // NSelect EventHandler
    this.TitleClick = TitleClickHandler;
    this.TitleMouseOver = TitleMouseOverHandler;
    this.TitleMouseOut = TitleMouseOutHandler;
    this.ListMouseDown = ListMouseDownHandler;
    this.ListMouseOver = ListMouseOverHandler;
    this.ListMouseOut = ListMouseOutHandler;
    this.CancelEvent = CancelEventHandler;

    // NSelect Function
    this.ModifyDiv = ModifyDivHandler;
    this.ChangeTitle = ChangeTitleHandler;
    this.ChangeList = ChangeListHandler;
    this.AddOption = AddOptionHandler;

    this.append = appendSList;
    this.Table = this.TableObj();

    SList[this.entry] = this;

    return;
}

function createObject( pSrc )
{      
    oObj = new Object();
    oObj.Div = document.createElement("DIV");
    oObj.Div.insertAdjacentHTML("afterBegin", pSrc);

    return oObj.Div.children(0);
}

function createTitle()
{
    var length = this.Items.length;

    for ( i = 0; i < length; i++ ) {
    if (this.Items.options[i].selected) {
        SIName = this.Items.options[i].innerText;
        SIValue = this.Items.options[i].value;
    }
    }

    this.Title = createObject(""
    +"<DIV id=title style='width:"+this.env.Width+";overflow-X:hidden;position:relative;left:0px;top:0px;"
    +"border:"+this.env.Border+";cursor:default;background:"+this.env.BGColor+";'"
    +"    onClick='SList["+this.entry+"].TitleClick( window.event );'"
    +"    onMouseOver='SList["+this.entry+"].TitleMouseOver( window.event );'"
    +"    onMouseOut='SList["+this.entry+"].TitleMouseOut( window.event );'"
    +">"
        +"<table height="+this.env.Height+" "+SL_Table+" style='table-layout:fixed;text-overflow:hidden;'>"
    +"<tr>"
        +"    <td style='width:100%;font-size:"+this.env.FontSize+";color:"+this.env.FontColor+";"+SL_Text+"'><nobr>"+SIName+"</nobr></td>"
        +"    <td style='display:none;'></td>"
        +"    <td align=center valign=center width="+SL_SBWidth+"><img src='"+SL_IPrefix+this.env.AImage+"' border=0 style='Filter:Alpha( Opacity=80 )'></td>"
    +"</tr>"
    +"</table>"
    +"</DIV>");

    oTitle_Sub = createObject(""
    +"<img style='position:absolute;top:1px;left:0;width:"+this.env.Width+";height:"+this.env.Height+";'"
    +"    ondragstart='SList["+this.entry+"].CancelEvent( window.event );'"
    +" src='"+SL_IPrefix+SL_BImage+"'>");

    this.Title.childNodes(0).cells(1).appendChild( this.Items );
    this.Title.childNodes(0).cells(2).appendChild( oTitle_Sub );

    return;
}

function createList()
{
    var ListDiv = ""
    +"<DIV id=list style='position:absolute;z-index:2;display:none;background:"+this.env.BGColor+";"
    +"border:"+this.env.Border+";font-size:"+this.env.FontSize+";color:"+this.env.FontColor+";cursor:default;"
    +"width:"+this.env.Width+";overflow-X:hidden;"+SL_ScrollBar+"'></DIV>";

    this.List = createObject( ListDiv );
    this.ChangeList();

    return;
}

function createSList()
{
    this.Items = this.ItemObj( this.src );

    this.TitleObj();
    this.ListObj();

    var table = createObject(""
        +"<table cellspacing=0 cellpadding=1 border=0>"
        +"<tr><td></td></tr>"
        +"</table>");

    table.cells(0).appendChild( this.Title );
    table.cells(0).appendChild( this.List );

    return table;
}

function changeSubNS( t, oSub ) {
    var s_idx = t.options.selectedIndex;
    oSub.Items.options.length = 0;

    for( i = 0; i < section_list[s_idx].length; i++ ) {
    content = section_list[s_idx][i].split(",");
    oSub.AddOption( content[0], content[1], 0 );
    }
    oSub.ChangeTitle();
    oSub.ChangeList();

    return;
}

/* Select Guide ALT function
    t : this
    f : form name
    e : event
*/
var divWidth;
var realWidth;
var tt_stat = false;
function showSelectGuide( f, e )
{
    if( UserAgent.indexOf("MSIE") < 0 || AppVersion < 5 ) return;

    if( tt_stat ) {
    if( e.x < realWidth / 2 )
        document.all.NSDiv.style.left = e.x+document.body.scrollLeft + 5;
    else
        document.all.NSDiv.style.left = e.x+document.body.scrollLeft - divWidth - 5;
       
    document.all.NSDiv.style.top = e.y + document.body.scrollTop + 5;
    }

    document.all.NSDiv.style.display = "block";

    return;
}  

function showSelectGuide_ALT(t, f, e)
{
    if( UserAgent.indexOf("MSIE") < 0 || AppVersion < 5 ) return;

    var s_idx = 0;
    var sub_url = "";
    realWidth = document.body.clientWidth - 148;
    divWidth = document.all.NSDiv.scrollWidth;

    if( !f.tt_sub || !f.u ) return;

    if( f.u.options ) {
    s_idx = f.u.options.selectedIndex;
    if(!f.tt_sub.length && f.tt_sub.value) sub_url=f.tt_sub.value;
    else if(f.tt_sub(s_idx) && f.tt_sub(s_idx).value) sub_url = f.tt_sub(s_idx).value;
    } else {
    if( f.tt_sub && f.tt_sub.value ) sub_url = f.tt_sub.value;
    }

    if( sub_url ) {
    tt_stat = true;
    document.all.NSDiv.innerHTML = ""
        +"<table width=400 cellspacing=0 cellpadding=0"
        +"<tr><td></td></tr></table>";

    content = ""
        +"<table height=20 bgcolor=#FEFFCB cellspacing=0 cellpadding=0"
        +" style='filter:alpha(opacity=100); border:1 solid #AFB086'>"
        +"<tr><td style='text-indent:2px;cursor:hand;font-size:9pt;height:16px;padding-top:2px;word-break:break-all;'>"
        +"<font color=black style='font-size:9pt'>"+sub_url+"</font>"
        +"</td><td width=10 nowrap></td></tr></table>";

    document.all.NSDiv.children(0).cells(0).innerHTML = content;
    showSelectGuide( f, e );
    } else {
    tt_stat = false;
    }

    return;
}

function hideSelectGuide_ALT()
{
    tt_stat = false;
   
    document.all.NSDiv.innerHTML = "";
    document.all.NSDiv.style.display = "none";

    return;
}

 

var lengthTable = Array(
    Array(1000000, "밀리미터", "mm"),
    Array(100000, "센티미터", "cm"),
    Array(1000, "미터", "m"),
    Array(1, "킬로미터", "km"),
    Array(39370.0789, "인치", "inch"),
    Array(3280.84, "피트", "ft"),
    Array(1093.613, "야드", "yd"),
    Array(0.62137, "마일", "mile"),
    Array(3300, "자", "尺"),
    Array(550, "간", "間"),
    Array(9.17, "정", "町"),
    Array(2.546, "리", "里")
);


var weightTable = Array(
    Array(1000000, "밀리그램", "mg"),
    Array(1000, "그램", "g"),
    Array(1, "킬로그램", "kg"),
    Array(0.001, "톤", "ton"),
    Array(15432, "그레인", "grain"),
    Array(35.273, "온스", "oz"),
    Array(2.20459, "파운드", "lb"),
    Array(266.666, "돈", null),
    Array(1.6666, "근", null),
    Array(0.26666, "관", null),
    Array(26.6666, "냥", null)
);

var areaTable = Array(
    Array(9917.4, "평방미터", "m²"),
    Array(99.174, "아르", "a"),
    Array(106794, "평방피트", "ft²"),
    Array(11861, "평방야드", "yd²"),
    Array(2.4506, "에이커", "acre"),
    Array(0.99174, "헥타아르", "ha"),
    Array(108000, "평방자", null),
    Array(3000, "평", null),
    Array(10, "단보", null),
    Array(1, "정보", null)
);

var volumeTable = Array(
    Array(10, "데시리터", "㎗"),
    Array(1000, "밀리리터", "㎖"),
    Array(1, "리터", "ℓ"),
    Array(1000, "입방센치", "cm³"),
    Array(0.001, "입방미터", "m³"),
    Array(61.027, "입방인치", "in³"),
    Array(0.03531, "입방피트", "ft³"),
    Array(0.00130, "입방야드", "yd³"),
    Array(0.26418, "갤론", "gallon"),
    Array(1000, "씨씨", "cc"),
    Array(5.54352, "홉", null),
    Array(0.554352, "되", null),
    Array(0.0554352, "말", null),
    Array(0.00629326, "배럴", "bbl")
);

var pressureTable = Array(
    Array(1, "atm", null),
    Array(14.695949, "psi", null),
    Array(1.033227, "kgf/cm²", null),
    Array(101325, "Pa", null),
    Array(101.325, "kPa", null),
    Array(1.01325,"bar", null),
    Array(1013250, "dyne/cm²", null),
    Array(760, "mmHg", null),
    Array(29.921, "inHg", null),
    Array(10332.274528, "mmH₂O", null),
    Array(406.782462, "inchH₂O", null)
);

var temperatureTable = Array(
    Array(null, "섭씨온도", "℃"),
    Array(null, "화씨온도", "℉"),
    Array(null, "절대온도", "K"),
    Array(null, "°R", null)
);

var lengthFrom, lengthTo;
var weightFrom, weightTo;
var areaFrom, areaTo;
var volumeFrom, volumeTo;
var temperatureFrom, temperatureTo;
var pressureFrom, pressureTo;

function unitCalc(type, from, to, value)
{
    var table = eval(type + "Table");

    if (!table)
        return -1;

    var i;
    var fromIndex = -1;
    var toIndex = -1;

    value = parseFloat(value);

    /* find "from" */
    for (i = 0; i < table.length; i++)
        if (table[i][1] == from || table[i][2] == from)
        {
            fromIndex = i;
            break
        }

    /* find "to" */
    for (i = 0; i < table.length; i++)
        if (table[i][1] == to || table[i][2] == to)
        {
            toIndex = i;
            break
        }

    if (fromIndex == -1 || toIndex == -1)
        return -1;

    if (type != "temperature")
    {
        result = table[toIndex][0]/table[fromIndex][0] * value;
    }
    else
    {

        /* convert to absolute temperature */
        switch (fromIndex)
        {
        case 0:
            value = value + 273.15;
            break;
        case 1:
            value = 5/9 * (value - 32) + 273.15;
            break;
        case 2:
            break;
        case 3:
            value = 5/9 * (value - 459.7 - 32) + 273.15;
        }

        /* convert absolute temperature to */
        switch (toIndex)
        {
        case 0:
            value = value - 273.15;
            break;
        case 1:
            value = 9/5 * (value - 273.15) + 32;
            break;
        case 2:
            break;
        case 3:
            value = 9/5 * (value - 273.15) + 32 + 459.7;
        }

        result = value;
    }

    result = Math.round(result * 1000000) / 1000000;

    return result;
}

function unitCalcDisplay(type, from, to, value)
{
    var i;
    var fromSelect = document.getElementById("s_" + type + "From");
    var toSelect = document.getElementById("s_" + type + "To");

    if (from)
    {
        var valueText = document.getElementById(type + "Value");

        if (!valueText || !fromSelect || !toSelect)
            return;

        valueText.value = value;

        for (i = 0; i < fromSelect.options.length; i++)
        {
            if (fromSelect.options[i].value == from)
                fromSelect.selectedIndex = i;

            if (toSelect.options[i].value == to)
                toSelect.selectedIndex = i;
        }
    }
    else
    {
        value = document.getElementById(type + "Value").value;
        from = fromSelect.options[fromSelect.selectedIndex].value;
        to = toSelect.options[toSelect.selectedIndex].value;
    }

    if (!value || !from || !to) return;

    var result = unitCalc(type, from, to, value);

    document.getElementById(type + "Result").value = result;
}

function unitCalculate(value, from, to)
{
    var fromExistFlag = false;
    var toExistFlag = false;
    var unit;
    var table;

    var i, j;

    for (j = 0; j < 6; j++)
    {
        switch (j)
        {
        case 0:
            unit = "length";
            break;
        case 1:
            unit = "weight";
            break;
        case 2:
            unit = "area";
            break;
        case 3:
            unit = "volume";
            break;
        case 4:
            unit = "pressure";
            break;
        case 5:
            unit = "temperature";
            break;
        }

        table = eval(unit + "Table");

        fromExistFlag = toExistFlag = false;

        for (i = 0; i < table.length; i++)
        {
            if (from == table[i][1])
                fromExistFlag = true;

            if (to == table[i][1])
                toExistFlag = true;
        }

        if (fromExistFlag && toExistFlag)
        {
            unitCalcDisplay(unit, from, to, value);
            return;
        }
    }
}

function printSelect(name, type)
{
    document.write("        <tr>");
    document.write("            <td nowrap align=center nowrap><font id=ln6 color=275361>" + name + "</font></td>");
    document.write("            <td width=25% align=center><input type=text size=15 style='height:21; border:1 solid C3CACD' id='" + type + "Value'></td>");
    document.write("            <td width=25% align=center>");
    document.write("            <table border=0 cellpadding=0 cellspacing=0>");
    document.write("            <tr>");
    document.write("                <td>");


    var i;
    var table = eval(type + "Table");
    var selectStr;

    selectStr = "<select id='s_" + type + "From' style='width:110;font-size:9pt;'>n";

    for (i = 0; i < table.length; i++)
    {
        selectStr += "<option value='" + table[i][1] + "'>";
        selectStr += table[i][1];
        selectStr += (table[i][2] ? " (" + table[i][2] + ")" : "") + "</option>";
    }

    eval(type + "From = NSelect(selectStr, 0, '#FFFFFF', '#EDEFF0', '1 solid #C3CACD', 'arrow_etcsrch.gif');");

    document.write("            </td>");
    document.write("            </tr>");
    document.write("            </table>");
    document.write("            </td>");
    document.write("            <td width=30 nowrap align=center><img src="http://www.blueb.co.kr/SRC/javascript/image2/date_arrow.gif border=0></td>");
    document.write("            <td width=25% align=center>");
    document.write("            <table border=0 cellpadding=0 cellspacing=0>");
    document.write("            <tr>");
    document.write("            <td>");

    selectStr = "<select id='s_" + type + "To' style='width:110;font-size:9pt'>n";

    for (i = 0; i < table.length; i++)
    {
        selectStr += "<option value='" + table[i][1] + "'>";
        selectStr += table[i][1];
        selectStr += (table[i][2] ? " (" + table[i][2] + ")" : "") + "</option>";
    }

    eval(type + "To = NSelect(selectStr, 0, '#FFFFFF', '#EDEFF0', '1 solid #C3CACD', 'arrow_etcsrch.gif');");

    document.write("            </td>");
    document.write("            </tr>");
    document.write("            </table>");
    document.write("            </td>");
    document.write("            <td width=70 nowrap align=center><a href=# onClick="unitCalcDisplay('" + type + "')"><img src="http://www.blueb.co.kr/SRC/javascript/image2/met_but01.gif border=0></a></td>");
    document.write("            <td width=25% align=center><input type=text size=15 style='height:21; border:1 solid C3CACD' id='" + type + "Result' readonly></td>");
    document.write("        </tr>");
}

function initUnitCalculator()
{
    document.write("<table border=0 cellpadding=0 cellspacing=0 width=100%><tr><td width=34 nowrap></td><td><font id=ln6><font color=#cf4900>단위 변환기</font> : 변환할 값에 숫자를 입력하고, 현재단위 및 변환할 단위를 선택한 후 변환하기 버튼을 누르면 단위가 변환됩니다.</font></td></tr><tr><td></td><td height=5 nowrap></td></tr></table>n");
    document.write("<table border=0 cellpadding=0 cellspacing=0 width=100%>");
    document.write("<tr>");
    document.write("    <td nowrap></td>");
    document.write("    <td nowrap bgcolor=C3CACD>");
    document.write("    <table border=0 cellpadding=0 cellspacing=1 width=100%>");
    document.write("    <tr bgcolor=F1F6F8>");
    document.write("        <td>");
    document.write("        <table border=0 cellpadding=0 cellspacing=3 width=100%>");
    document.write("        <tr>");
    document.write("            <td nowrap align=center><font id=ln6 color=275361></font></td>");
    document.write("            <td width=25% align=center><font id=ln6 color=275361>변환할 값</font></td>");
    document.write("            <td width=25% align=center><font id=ln6 color=275361>현재단위</font></td>");
    document.write("            <td width=30 nowrap align=center><font id=ln6 color=275361></font></td>");
    document.write("            <td width=25% align=center><font id=ln6 color=275361>변환할 단위</font></td>");
    document.write("            <td width=70 nowrap align=center><font id=ln6 color=275361></font></td>");
    document.write("            <td width=25% align=center><font id=ln6 color=275361>결과</font></td>");
    document.write("        </tr>");
    document.write("        </table>");
    document.write("        </td>");
    document.write("    </tr>");
    document.write("    <tr bgcolor=ffffff>");
    document.write("        <td>");
    document.write("        <table border=0 cellpadding=0 cellspacing=4 width=100%>");

    printSelect("길이", "length");
    printSelect("무게", "weight");
    printSelect("넓이", "area");
    printSelect("부피", "volume");
    printSelect("압력", "pressure");
    printSelect("온도", "temperature");

    document.write("        </table>");
    document.write("        </td>");
    document.write("    </tr>");
    document.write("    </table>");
    document.write("    </td>");
    document.write("    <td width=100%></td>");
    document.write("</tr>");
    document.write("</table>");

}

initUnitCalculator();

/* default unit */
unitCalcDisplay("length", "인치", "센티미터", "");
unitCalcDisplay("weight", "킬로그램", "파운드", "");
unitCalcDisplay("area", "평방미터", "평", "");
unitCalcDisplay("volume", "리터", "입방미터", "");
unitCalcDisplay("pressure", "Pa", "mmHg", "");
unitCalcDisplay("temperature", "섭씨온도", "화씨온도", "");


</script>

댓글목록

등록된 댓글이 없습니다.

회원로그인

접속자집계

오늘
60
어제
302
최대
1,347
전체
155,121
Latest Crypto Fear & Greed Index

그누보드5
Copyright © 서방님.kr All rights reserved.