日期:2014-05-18  浏览次数:20425 次

怎样在ASP.NET中实现DropDownList与CheckBoxList的无刷新联动
近日在做一个小网站,需要实现DropDownList与CheckBoxList的无刷新联动,网上有很多关于两个及以上DropDownList联动的例子!但还没有看到DropDownList与CheckBoxList的无刷新联动的例子,我按照DropDownList联动的例子改写DropDownList与CheckBoxList的无刷新联动,但一直有问题!
<script   language= "javascript "   type= "text/jscript ">
            function   load(MC_ID)
            {
                    var   drp2   =   document.getElementById( "CheckBoxList1 ");
                    function   RemoveAll(oElem)
                    {                  
                            var   i   =   0;  
                            for   (i   =   oElem.length;   i   > =   0;   i--)
                            {  
                                    oElem.options.remove(i);  
                            }  
                    }  
                    RemoveAll(drp2)  
                    var   oHttpReq   =   new   ActiveXObject( "MSXML2.XMLHTTP ");
                    var   oDoc   =   new   ActiveXObject( "Microsoft.XMLDOM ");
                    oHttpReq.open( "POST ",   "DropChild.aspx?ClassID= "+MC_ID,   false);
                   
                    oHttpReq.send( " ");
                    result   =   oHttpReq.responseText;
                 
                    oDoc.loadXML(result);
                    items1   =   oDoc.selectNodes( "//Table/MC_Name ");  
                    items2   =   oDoc.selectNodes( "//Table/MC_ID ");  
                                             
                    var   itemsLength=items1.length;
                     
                    alert(itemsLength);