码迷,mamicode.com
首页 > Web开发 > 详细

JS+jquery 计算服务器控件textbox的值并显示在lable上

时间:2015-02-28 10:06:17      阅读:146      评论:0      收藏:0      [点我收藏+]

标签:

更好的方法求共同学习。 

//通用
            function Change(clientId) {
                var sampleQuantity = $("input[id*=" + clientId + "_TextBoxSampleNumber]").val();//样本数
                var qualfiedQuantity = $("input[id*=" + clientId + "_TextBoxQualfiedNumber]").val();//合格数
                var labelUnQualfiedNumber = document.getElementById(clientId + "_LabelUnQualfiedNumber");
                var labelYield = document.getElementById(clientId + "_LabelYield");
                if (sampleQuantity != 0) {
                    if (qualfiedQuantity != ‘‘) {
                        labelUnQualfiedNumber.innerHTML = (parseFloat(sampleQuantity) - parseFloat(qualfiedQuantity)).toString();
                        labelYield.innerHTML = ((parseFloat(qualfiedQuantity) / parseFloat(sampleQuantity)) * 100).toFixed(3) + "%";
                    } else {
                        labelUnQualfiedNumber.innerHTML = ‘‘;
                        labelYield.innerHTML = ‘‘;
                    }
                }

            }

JS+jquery 计算服务器控件textbox的值并显示在lable上

标签:

原文地址:http://www.cnblogs.com/waliy/p/4304749.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!