在Repeater里的文本框Onblur事件触发后在Repeater外一个文件框进行数值统计的javascript(住:tab为Repeater外的表格id、txtSalary_sum为Repeater外的文本框

<scripttype="text/javascript">

 

        functiongetAll() {

            vartab=document.getElementById("tab");

            if (tab) {

                varinputs=tab.getElementsByTagName("input");

                varSalary_sum=0;

                for (vari=0; i<inputs.length; i++) {

                    if (inputs[i].type=="text") {

                        varovalue=inputs[i].value;

                        if (ovalue==""||isNaN(ovalue)) {

                            ovalue=0;

                        }

                        else {

                            ovalue=parseFloat(ovalue);

                            Salary_sum+=ovalue;

                        }

                    }

                }

                vartxtSalary_sum=document.getElementById("txtSalary_sum");

                if (txtSalary_sum) {

                    txtSalary_sum.value=Salary_sum;

                }

            }

        }

    </script>

posted on 2012-09-05 18:35  yxfaction  阅读(325)  评论(0编辑  收藏  举报

导航