首页新闻找找看学习计划

js问题????

0
[已关闭问题] 关闭于 2015-10-10 10:06

这是项目里本来有的js

<script type='text/javascript'>var IsCheckDateOfCtrId='';        $(function() {            SetCheckEmptyJS();        });function SetCheckEmptyJS () {
        $('#txtName').focusout(function () {            if ($('#txtName').val() == '') {                $('#txtName').attr('class', 'RequiredWarningTextBoxBorderStyle');            }            else {                $('#txtName').attr('class', 'tbox');            }            ClearLblError();        });
        $('#txtAddress').focusout(function () {            if ($('#txtAddress').val() == '') {                $('#txtAddress').attr('class', 'RequiredWarningTextBoxBorderStyle');            }            else {                $('#txtAddress').attr('class', 'tbox');            }            ClearLblError();        });
        $('#txtCorp').focusout(function () {            if ($('#txtCorp').val() == '') {                $('#txtCorp').attr('class', 'RequiredWarningTextBoxBorderStyle');            }            else {                $('#txtCorp').attr('class', 'tbox');            }            ClearLblError();        });
        $('#txtContact').focusout(function () {            if ($('#txtContact').val() == '') {                $('#txtContact').attr('class', 'RequiredWarningTextBoxBorderStyle');            }            else {                $('#txtContact').attr('class', 'tbox');            }            ClearLblError();        });
        $('#txtDesScale').focusout(function () {            if ($('#txtDesScale').val() == '') {                $('#txtDesScale').attr('class', 'RequiredWarningTextBoxBorderStyle');            }            else {                $('#txtDesScale').attr('class', 'tbox');            }            ClearLblError();        });
        $('#txtFacilities').focusout(function () {            if ($('#txtFacilities').val() == '') {                $('#txtFacilities').attr('class', 'RequiredWarningTextBoxBorderStyle');            }            else {                $('#txtFacilities').attr('class', 'tbox');            }            ClearLblError();        });
 
 
 
 
        $('#ddlCateagory').change(function () {            if ($(this).val() == '') {                $('#sp_ddlCateagory').attr('class', 'RequiredWarningDropDownListBorderStyle');            }            else {                $('#sp_ddlCateagory').attr('class', '');            }            ClearLblError();        });
 
 
                                                                                            $('#btnAdd').click(function () {            if ($('#txtName').val() == '') {                $('#txtName').attr('class', 'RequiredWarningTextBoxBorderStyle');               ClearLblError();            }            else {                $('#txtName').attr('class', 'tbox');            }            ClearLblError();
            if ($('#txtAddress').val() == '') {                $('#txtAddress').attr('class', 'RequiredWarningTextBoxBorderStyle');               ClearLblError();            }            else {                $('#txtAddress').attr('class', 'tbox');            }            ClearLblError();
            if ($('#txtCorp').val() == '') {                $('#txtCorp').attr('class', 'RequiredWarningTextBoxBorderStyle');               ClearLblError();            }            else {                $('#txtCorp').attr('class', 'tbox');            }            ClearLblError();
            if ($('#txtContact').val() == '') {                $('#txtContact').attr('class', 'RequiredWarningTextBoxBorderStyle');               ClearLblError();            }            else {                $('#txtContact').attr('class', 'tbox');            }            ClearLblError();
            if ($('#txtDesScale').val() == '') {                $('#txtDesScale').attr('class', 'RequiredWarningTextBoxBorderStyle');               ClearLblError();            }            else {                $('#txtDesScale').attr('class', 'tbox');            }            ClearLblError();
            if ($('#txtFacilities').val() == '') {                $('#txtFacilities').attr('class', 'RequiredWarningTextBoxBorderStyle');               ClearLblError();            }            else {                $('#txtFacilities').attr('class', 'tbox');            }            ClearLblError();
 
 
            if ($('#ddlCateagory').val() == '') {                $('#sp_ddlCateagory').attr('class', 'RequiredWarningDropDownListBorderStyle');               ClearLblError();            }            else {                $('#sp_ddlCateagory').attr('class', '');            }            ClearLblError();
 
        });
    
        $('#btnEdit').click(function () {            if ($('#txtName').val() == '') {                $('#txtName').attr('class', 'RequiredWarningTextBoxBorderStyle');               ClearLblError();            }            else {                $('#txtName').attr('class', 'tbox');            }            ClearLblError();
            if ($('#txtAddress').val() == '') {                $('#txtAddress').attr('class', 'RequiredWarningTextBoxBorderStyle');               ClearLblError();            }            else {                $('#txtAddress').attr('class', 'tbox');            }            ClearLblError();
            if ($('#txtCorp').val() == '') {                $('#txtCorp').attr('class', 'RequiredWarningTextBoxBorderStyle');               ClearLblError();            }            else {                $('#txtCorp').attr('class', 'tbox');            }            ClearLblError();
            if ($('#txtContact').val() == '') {                $('#txtContact').attr('class', 'RequiredWarningTextBoxBorderStyle');               ClearLblError();            }            else {                $('#txtContact').attr('class', 'tbox');            }            ClearLblError();
            if ($('#txtDesScale').val() == '') {                $('#txtDesScale').attr('class', 'RequiredWarningTextBoxBorderStyle');               ClearLblError();            }            else {                $('#txtDesScale').attr('class', 'tbox');            }            ClearLblError();
            if ($('#txtFacilities').val() == '') {                $('#txtFacilities').attr('class', 'RequiredWarningTextBoxBorderStyle');               ClearLblError();            }            else {                $('#txtFacilities').attr('class', 'tbox');            }            ClearLblError();
 
 
            if ($('#ddlCateagory').val() == '') {                $('#sp_ddlCateagory').attr('class', 'RequiredWarningDropDownListBorderStyle');               ClearLblError();            }            else {                $('#sp_ddlCateagory').attr('class', '');            }            ClearLblError();
 
        });
    
    };
 
function ClearLblError()
                    {
                        if(document.getElementById('lblError')!=null)
                        {
                            document.getElementById('lblError').innerText = '';
                        }
                    }
                  </script>

现在ddlcategory的值不是空判断,而是-1,我在页面上得怎么添加

lctk的主页 lctk | 初学一级 | 园豆:69
提问于:2015-07-28 09:20
< >
分享
所有回答(4)
0

    😄

✎﹏ℳ๓₯㎕ღ | 园豆:1497 (小虾三级) | 2015-07-28 09:35
0

同上

liqipeng | 园豆:1160 (小虾三级) | 2015-07-28 10:02
0

ctrl + F 找到所有关于ddlCateagory的事件绑定,一个一个改

sam.c | 园豆:148 (初学一级) | 2015-07-28 11:02
0

关于ddl绑定的话,既然你用js写的,就用js获取,并赋值,可以给一个隐藏的控件,后台在获取,并绑定

quan0zhou | 园豆:41 (初学一级) | 2015-07-29 09:35
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册