I usually pass an object literal as an argument to my functions. This approach takes away the need of using global variables and makes the disconnect from ASP.NET controls/JavaScript functions a little less complex and more verbose:
JavaScript:
function fn(ids)
{
var controlOne = ids.controlOne,
controlTwo = ids.controlTwo,
controlThree = ids.controlThree;
}
ASP.NET:
fn({
controlOne: "<%= ControlOne.ClientID %>",
controlTwo: "<%= ControlTwo.ClientID %>",
controlThree: "<%= ControlThree.ClientID %>"
});
Another approach would be to target your inputs by class-names:
ASP.NET:
<asp:TextBox ... CssClass="controlone" />
<asp:TextBox ... CssClass="controltwo" />
<asp:TextBox ... CssClass="controlthree" />
JavaScript:
function fn()
{
var controlOne = document.getElementsByClassName("controlone"),
controlTwo = document.getElementsByClassName("controltwo"),
controlThree = document.getElementsByClassName("controlthree");
}
All of this can be simplified greatly by using jQuery or some other JavaScript framework.