[小代码]重置查询控件的JS代码

function ResetAllControls(ctrlName){
    
var ctrlParent;
    
if (ctrlName == ""{ ctrlParent = document; }
    
    ctrlParent 
= document.getElementById(ctrlName);
    
if (ctrlParent == null)  return;}

    
var ctrl;
    ctrl 
= ctrlParent.getElementsByTagName("INPUT");
    
if (ctrl.length > 0{
        
for (var i = 0; i < ctrl.length; i++){
            
if (ctrl[i].getAttribute("TYPE").toLowerCase() == "text"{
                ctrl[i].value 
= "";
            }

        }

    }

    
    ctrl 
= ctrlParent.getElementsByTagName("SELECT");
    
if (ctrl.length > 0{
        
for (var i = 0; i < ctrl.length; i++){
            
if (ctrl[i].options.length > 0
                ctrl[i].options[
0].selected = true
            }

        }

    }

}
posted @ 2006-01-04 11:23  Elaine Shi  阅读(1318)  评论(0编辑  收藏  举报