js和JQuery实现回车代替Tab键(按回车跳到下一栏)小写转大写

https://zhidao.baidu.com/question/470044049.html 实现思路
https://zhidao.baidu.com/question/584435112796698605.html
http://www.fly63.com/article/detial/434?type=2
https://zhidao.baidu.com/question/200562167881692765.html
https://blog.csdn.net/violetjack0808/article/details/79103354
https://bbs.csdn.net/topics/390937294
https://www.cnblogs.com/lenther2002/p/4749417.html
多行input安回车键跳转到下一行
var inputs = $("#oTable0 :text");         
             var j=0;
             $('input').keydown(function(e){
               if(e.keyCode==13){
                  for(var i=0;i<inputs.length;i++){
                   if(j==(inputs.length-1)){
                    inputs[0].focus();
                    break;
                  }else {
                     j++;
                     inputs[j].focus();
                     break;
                  }
                 }               
               }
            });
   
   //把field10291 数字转成大写填入field10231中
<!-- script代码,如果需要引用js文件,请使用与HTML中相同的方式。 -->
<script type="text/javascript">
function changeMoneyToChinese(money){ 
        var cnNums = new Array("零","壹","贰","叁","肆","伍","陆","柒","捌","玖"); //汉字的数字 
        var cnIntRadice = new Array("","拾","佰","仟"); //基本单位 
        var cnIntUnits = new Array("","万","亿","兆"); //对应整数部分扩展单位 
        var cnDecUnits = new Array("角","分","毫","厘"); //对应小数部分单位 
        var cnInteger = "整"; //整数金额时后面跟的字符 
        var cnIntLast = "元"; //整型完以后的单位 
        var maxNum = 999999999999999.9999; //最大处理的数字 
         
        var IntegerNum; //金额整数部分 
        var DecimalNum; //金额小数部分 
        var ChineseStr=""; //输出的中文金额字符串 
        var parts; //分离金额后用的数组,预定义 
        if( money == "" ){ 
            return ""; 
        } 
        money = parseFloat(money); 
        if( money >= maxNum ){ 
            $.alert('超出最大处理数字'); 
            return ""; 
        } 
        if( money == 0 ){ 
            ChineseStr = cnNums[0]+cnIntLast+cnInteger; 
            //document.getElementById("show").value=ChineseStr; 
            return ChineseStr; 
        } 
        money = money.toString(); //转换为字符串 
        if( money.indexOf(".") == -1 ){ 
            IntegerNum = money; 
            DecimalNum = ''; 
        }else{ 
            parts = money.split("."); 
            IntegerNum = parts[0]; 
            DecimalNum = parts[1].substr(0,4); 
        } 
        if( parseInt(IntegerNum,10) > 0 ){//获取整型部分转换 
            zeroCount = 0; 
            IntLen = IntegerNum.length; 
            for( i=0;i<IntLen;i++ ){ 
                n = IntegerNum.substr(i,1); 
                p = IntLen - i - 1; 
                q = p / 4; 
                m = p % 4; 
                if( n == "0" ){ 
                    zeroCount++; 
                }else{ 
                    if( zeroCount > 0 ){ 
                        ChineseStr += cnNums[0]; 
                    } 
                    zeroCount = 0; //归零 
                    ChineseStr += cnNums[parseInt(n)]+cnIntRadice[m]; 
                } 
                if( m==0 && zeroCount<4 ){ 
                    ChineseStr += cnIntUnits[q]; 
                } 
            } 
            ChineseStr += cnIntLast; 
            //整型部分处理完毕 
        } 
        if( DecimalNum!= '' ){//小数部分 
            decLen = DecimalNum.length; 
            for( i=0; i<decLen; i++ ){ 
                n = DecimalNum.substr(i,1); 
            //此处if 控制0角是否显示
              //  if( n != '0' ){ 
            //alert("0.01");
                    ChineseStr += cnNums[Number(n)]+cnDecUnits[i]; 
              //  } 
            } 
        } 
        if( ChineseStr == '' ){ 
            ChineseStr += cnNums[0]+cnIntLast+cnInteger; 
        }else if( DecimalNum == '' ){ 
            ChineseStr += cnInteger; 
        } 
        //alert(ChineseStr); 
        return ChineseStr; 
    } 
jQuery(document).ready(function(){
       //alert("0");
       //把field10291 数字转成大写填入field10231中
       //alert(jQuery("#field10291").val());
       //alert(changeMoneyToChinese(jQuery("#field10291").val()));
       jQuery("#field10231").val(changeMoneyToChinese(jQuery("#field10291").val()));
       jQuery("#field10231span").html(changeMoneyToChinese(jQuery("#field10291").val()));
       jQuery("#field10291").change(function(){
            //alert("0");
            //alert(jQuery("#field10291").val());
            //alert(changeMoneyToChinese(jQuery("#field10291").val()));
            jQuery("#field10231").val(changeMoneyToChinese(jQuery("#field10291").val()));
            jQuery("#field10231span").html(changeMoneyToChinese(jQuery("#field10291").val()));         
        });

});
</script> 
   

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值