• 数字转为大写,钱转为大写格式


    <html>
    <head>
        <meta name="viewport" content="width=device-width" />
        <title>FanTi</title>
        <script src="~/js/jquery-1.7.1.min.js"></script>
        <script type="text/javascript">
            function piliskys(value) {
                if (isNaN(value)) {
                    return;
                } else {
                    var money1 = new Number(value);
                    var monee = Math.round(money1 * 100).toString(10);
    
                    var i;
                    var leng = monee.length;
                    var monval = "";
                    for (i = 0; i < leng; i++) {
                        monval = monval + to_upper(monee.charAt(i)) + to_mon(leng - i - 1);
                    }
                    repace_acc(monval);
                }
            }
    
            function to_upper(a) {
                switch (a) {
                    case '0': return ''; break;
                    case '1': return ''; break;
                    case '2': return ''; break;
                    case '3': return ''; break;
                    case '4': return ''; break;
                    case '5': return ''; break;
                    case '6': return ''; break;
                    case '7': return ''; break;
                    case '8': return ''; break;
                    case '9': return ''; break;
                    default: return '';
                }
            }
    
            function to_mon(a) {
                if (a > 10) {
                    a = a - 8;
                    return (to_mon(a));
                }
                switch (a) {
                    case 0: return ''; break;
                    case 1: return ''; break;
                    case 2: return ''; break;
                    case 3: return ''; break;
                    case 4: return ''; break;
                    case 5: return ''; break;
                    case 6: return ''; break;
                    case 7: return ''; break;
                    case 8: return ''; break;
                    case 9: return ''; break;
                    case 10: return '亿'; break;
                }
            }
    
            function repace_acc(Money) {
                Money = Money.replace("零分", "");
                Money = Money.replace("零角", "");
                var yy = 0;
                var outmoney = Money;
                while (true) {
                    var lett = outmoney.length;
                    outmoney = outmoney.replace("零圆", "");
                    outmoney = outmoney.replace("零万", "");
                    outmoney = outmoney.replace("零亿", "亿");
                    outmoney = outmoney.replace("零仟", "");
                    outmoney = outmoney.replace("零佰", "");
                    outmoney = outmoney.replace("零零", "");
                    outmoney = outmoney.replace("零拾", "");
                    outmoney = outmoney.replace("亿万", "亿零");
                    outmoney = outmoney.replace("万仟", "万零");
                    outmoney = outmoney.replace("仟佰", "仟零");
                    yy = outmoney.length;
                    if (yy == lett) break;
                }
                yy = outmoney.length;
                if (outmoney.charAt(yy - 1) == '') {
                    outmoney = outmoney.substring(0, yy - 1);
                }
                yy = outmoney.length;
                if (outmoney.charAt(yy - 1) == '') {
                    outmoney = outmoney + '';
                }
                $("#upTotal").html( outmoney);
            }
    
            function keUp(e)
            {
                piliskys($(e).val());
            }
        </script>
    </head>
    <body>
        <input onkeyup="keUp(this)"  type="text" placeholder="请输入数字" />
        <div id="upTotal">
            
        </div>
    </body>
    </html>

    数字钱,转为大写

  • 相关阅读:
    Airflow使用笔记
    公共关系学(第二版)笔记
    公众关系秘籍
    SQL SERVER XML 学习总结
    hadoop 1.2.1 配置
    ssh
    centos&windows的共享文件(通过挂载)
    代理设置(wget/yum)
    环境变量设置
    centos7 自定义服务
  • 原文地址:https://www.cnblogs.com/LJP-JumpAndFly/p/6075511.html
Copyright © 2020-2023  润新知