换算方法在这里:http://baike.baidu.com/view/2109667.htm?fr=aladdin代码就不给了。

解决方案 »

  1.   

    自己补全其他代码<!DOCTYPE html><html>
    <head>
        <title>隐形眼镜度数换算</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=yes" />
        <script src="/Content/jquery-1.8.3.min.js"></script>
    </head>
    <body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
        <!-- Save for Web Slices (换算.psd) -->
        <div style="background-color: #ffffff; font-family: 微软雅黑; font-size: 18px;">
            <div style="width: 320px; margin: 0 auto;">
                <div style="background-color: #e50077; height: 50px;">
                    <div style="float: left; padding-left: 20px;">
                        <img src="/Content/images/calc/hs_02.jpg" /></div>
                    <div style="float: right;">
                        <img src="/Content/images/calc/hs_03.jpg" /></div>
                </div>
                <div style=" width:300px; padding:0 10px;">
                <div style="height: 42px;">
                    <div style="float: right">
                       <a href="/"> <img src="/Content/images/calc/hs_05.jpg" /></a></div>
                </div>
                <!--  近视 -->
                <div style="height: 48px; line-height: 48px; color: #000;">框架镜近视度数(D)</div>
                <div style="height: 26px;">
                    <div style="float: left; width: 48px;">
                        <img src="/Content/images/calc/hs_07.png" /></div>
                    <div style="float: left;">
                        -                </div>
                    <div style="float: left;">
                        <select id="dd1"  onchange="ismax()" style="width: 66px; height: 24px; background: url(/Content/images/calc/hs_10.png) no-repeat 0 0; border: 0; margin-left: 5px;padding: 0 15px;">
                            <option value="0">0</option>
                            <option value="1">1</option>
                            <option value="2">2</option>
                            <option value="3">3</option>
                            <option value="4">4</option>
                            <option value="5">5</option>
                            <option value="6">6</option>
                            <option value="7">7</option>
                            <option value="8">8</option>
                            <option value="9">9</option>
                            <option value="10">10</option>
                            <option value="11">11</option>
                            <option value="12">12</option>
                            
                        </select>
                    </div>
                    <div style="float: left;">
                        <select id="dd2" style="width: 93px; height: 24px; background: url(/Content/images/calc/hs_11.png) no-repeat 0 0; border: 0; margin-left: 5px;padding: 0 15px;">
                            <option value="00">.00</option>
                            <option value="25">.25</option>
                            <option value="50">.50</option>
                            <option value="75">.75</option>
                        </select>
                    </div>
                </div>            <!--  散光 -->
                <div style="height: 48px; line-height: 48px; color: #000; clear:both;">框架镜散光度数(D)</div>
                <div style="height: 26px;">
                    <div style="float: left; width: 48px;">
                        <img src="/Content/images/calc/hs_07.png" /></div>
                    <div style="float: left;">
                        <select id="dd3" style="width: 114px; height: 24px; background: url(/Content/images/calc/hs_15.png) no-repeat 0 0; border: 0; margin-left: 5px;padding: 0 15px;">
                            <option value="0.00">0.00</option>
                            <option value="-0.50">-0.50</option>
                            <option value="-0.75">-0.75</option>
                            <option value="-1.00">-1.00</option>
                        </select>
                    </div>
                </div>            <!-- 按钮 -->
                <div style="height: 60px;">
                    <div style="width: 133px; height: 36px; font-weight: bold; color: #fff; display: block; margin-top: 25px; margin-left: 141px; background-color: #e50077; text-align: center; white-space: nowrap; vertical-align: middle; cursor: pointer; border: 1px solid transparent; border-radius: 4px; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; -o-user-select: none;">
                        <a href="javascript:;" id="url" onclick="CalculatorHtml()"  style="color: #FFF; padding: 10px; text-decoration: none; line-height: 36px;">点击换算</a>
                    </div>
                </div>
                <!-- 输出度数 -->
                <div style="height: 24px; margin-top: 25px;">
                    <div style="float: left; width: 40px;">
                        <img src="/Content/images/calc/hs_18.png" /></div>
                    <div style="float: left; line-height: 18px; color: #000;">隐形眼镜度数:</div>               
                </div>
       <div style="font-size: 28px;color: #e50077; text-align: center;margin-top:20px;" id="showcalculator">0.00</div>
                <div style="color: #F00; font-size: 12px; text-align: left; margin-top:24px;">
                    注:如果您有-1.00以内散光,可在该换算器中换算角膜镜度数,如散光度数超过-1.00,需要配散光片请联系客服或在订单中备注。
                </div>
                <div style="width: 270px; height: 69px; background-color: #dedede; color: #888888; font-size: 14px; margin: 0 auto; text-align: center; margin-top: 16px;">
                    <div>换算神器好用么?</div>
                    <div>赶紧点击右上角分享给业内好友吧!</div>
                    <div>(公众微信号 aidaiwang)</div>
                </div>
                </div>
            </div>
            
        </div>
        <script type="text/javascript">
            
            function CalculatorHtml()
            {
                var dd1 = $("#dd1").val();
                var dd2 = $("#dd2").val();
                var dd3 = $("#dd3").val();
                if(parseInt( dd1)>=4)
                {
                    $.post("/Ajax/ProHandler.ashx", { type: "calc", dd1: dd1, dd2: dd2, dd3: dd3 }, function (data) {
                        $("#showcalculator").html(moneyfomat(data, 2));
                    });
                }
                else
                {
                    $("#showcalculator").html("<div style='font-size: 20px;'>您选择的度数不需要换算哦!</div>");
                }
            }
            function ismax() {
                var dd1 = $("#dd1").val();
               // alert(dd1);
                if (dd1 == "12") {
                    $("#dd2").html("<option value='00'>.00</option>");
                }
                else {
                    $("#dd2").html("<option value=\"00\">.00</option><option value=\"25\">.25</option><option value=\"50\">.50</option><option value=\"75\">.75</option>");
                }
            }
            
            function moneyfomat(s, n) {
                n = n > 0 && n <= 20 ? n : 2;
                s = parseFloat((s + "").replace(/[^\d\.-]/g, "")).toFixed(n) + "";
                var l = s.split(".")[0].split("").reverse(),
                r = s.split(".")[1];
                t = "";
                for (i = 0; i < l.length; i++) {
                    t += l[i] + ((i + 1) % 3 == 0 && (i + 1) != l.length ? "," : "");
                }
                return t.split("").reverse().join("") + "." + r;
            }    </script>
        <!-- End Save for Web Slices -->
    </body>
    </html>
      

  2.   

    type:calc
    dd1:7
    dd2:00
    dd3:-0.75参数
      

  3.   

    $.post("/Ajax/ProHandler.ashx", { type: "calc", dd1: dd1, dd2: dd2, dd3: dd3 }, function (data) {
                        $("#showcalculator").html(moneyfomat(data, 2));
                    });
      

  4.   

    楼上的只是前端的一些代码,而且是.net的,能用个PHP写个类似的么,谢谢了!