Dropdownlist在按钮点击时失去其价值

时间:2016-05-13 05:58:27

标签: javascript asp.net drop-down-menu

我的angular.module('app', ['ngAnimate']) .controller('Fade', ['$scope', '$timeout', function ($scope, $timeout) { $scope.init = function () { $scope.data = "This text will fade-in"; $timeout(function () { $scope.bool = true; }, 2000); }; }]); 的值来自其他列表的选择。

因此,当我从dropdownlist中选择值然后点击dropdownlist时,我的选定值就会丢失。以下是我的js代码: -

button

另见HTML

function FunDeptChange(StrPriId,StrPriDeptId)
{
    //fill user
    if(Trim(document.getElementById(StrPriDeptId).value) != "") 
    {
        StrPriFnName = "FunGetUsersInDept("+document.getElementById(StrPriDeptId).value+")";
        var ObjPriXMLHTTP = new ActiveXObject("Microsoft.XMLHTTP")
        ObjPriXMLHTTP.open("GET","FrmInwardXMLHTTP.aspx?para="+StrPriFnName,false);
        ObjPriXMLHTTP.send("");
        if(Trim(ObjPriXMLHTTP.responseText) != "")
        {
            document.getElementById(StrPriId).innerHTML = "";
            var ObjPriOption = document.createElement("Option");
            ObjPriOption.text = "--- Select ---";
            ObjPriOption.value = "";
            document.getElementById(StrPriId).add(ObjPriOption);

            StrPriRow = ObjPriXMLHTTP.responseText.split('|');
            for(IntPriI=0; IntPriI<StrPriRow.length-1; IntPriI++)
            {
                StrPriCol = StrPriRow[IntPriI].split('~');
                var ObjPriOption = document.createElement("Option");
                ObjPriOption.text = StrPriCol[1]+" "+StrPriCol[2]+" "+StrPriCol[3];
                ObjPriOption.value = StrPriCol[0];
                document.getElementById(StrPriId).add(ObjPriOption);
            }

            if (document.getElementById('CmbNextAction').value == "8" || document.getElementById('CmbNextAction').value == "4" || document.getElementById('CmbNextAction').value == "12" )
            {
                StrPriFnName = "FunGetDefultDeptUser("+document.getElementById('CmbNextDept').value+ ")";
                var ObjPriXMLHTTP = new ActiveXObject("Microsoft.XMLHTTP")
                ObjPriXMLHTTP.open("GET","FrmInwardXMLHTTP.aspx?para="+StrPriFnName,false);
                ObjPriXMLHTTP.send("");

                if(Trim(ObjPriXMLHTTP.responseText) == "")
                 {
                     FunMessageBox("Default User of Selected Department has Not define. Please Contact to Administrator",16,StrPriTitle);
                     //document.getElementById('TxtReceiptNo').focus();
                     return false;
                 }
                 else
                 {
                    document.getElementById('CmbNextUser').value = ObjPriXMLHTTP.responseText;
                    document.getElementById('CmbNextUser').disabled=true; 
                 }
                 if(document.getElementById('CmbNextAction').value == "12")
                 {
                        document.getElementById('CmbNextUser').disabled=false; 
                 }
            }

        }
        else
        {
            document.getElementById(StrPriId).innerHTML = "";
            var ObjPriOption = document.createElement("Option");
            ObjPriOption.text = "--- Select ---";
            ObjPriOption.value = "";
            document.getElementById(StrPriId).add(ObjPriOption);
        }
    }
    else
    {
        document.getElementById(StrPriId).innerHTML = "";
        var ObjPriOption = document.createElement("Option");
        ObjPriOption.text = "--- Select ---";
        ObjPriOption.value = "";
        document.getElementById(StrPriId).add(ObjPriOption);
    }
    //end of code to fill user
}

已更新

我的按钮看起来像浏览器呈现的HTML

<select id="CmbNextDept" runat="server" onchange="FunDeptChange('CmbNextUser','CmbNextDept')" >
                                    <option value="">--- Select ---</option>
                                </select>

0 个答案:

没有答案