JS gets the current year in uppercase and displays it in jsp

: Because the year is dynamic, it is not necessary for the user to fill in each time, so the current year is automatically obtained and replaced.

1.JS - "Get the time and convert it to uppercase, for example: "2019"

<script type="text/javascript">function ngReady(scope){
    var today=new Date();
    var chinese = ['〇', '一', '二', '三', '四', '五', '六', '七', '八', '九'];
    var y = today.getFullYear().toString();
    var result = "";
    for (var i = 0; i < y.length; i++) {
        result += chinese[y.charAt(i)];
    }
    result+="年";
    if(scope.data.TC_QN_JCYJJH_OBJ.sub_TC_QN_JCYJJH[0].NFZS == null || scope.data.TC_QN_JCYJJH_OBJ.sub_TC_QN_JCYJJH[0].NFZS == ""){
        scope.data.TC_QN_JCYJJH_OBJ.sub_TC_QN_JCYJJH[0].NFZS = result;
    }
}</script>

2. Display at the front desk, hide the input box, this is AngularJs for use

<input ht-input="item.NFZS" desc="年份展示" style="border: none;box-shadow: none;background: none;ext-align:center;" disabled="disabled" type="text" ng-model="item.NFZS"/>

 

Guess you like

Origin blog.csdn.net/ke_new/article/details/96825267