If you truly want to be able to pass or not pass arguments arbitrarily in Active Server Pages you can revert to JScript, which allows you to pass as few or as many arguments as you like:
<%@language=JScript%>
<%
// Don't declare any arguments in the function declaration:
function SomeArgs() {
var strReturn = new String('');
// Instead, use the intrinsic arguments object to retrieve arguments.
// This loops through the arguments object appending the value of each
// to the result:
for (i=0; i<arguments.length; i++) {
strReturn += arguments[i];
}
return(strReturn);
}
// Pass whatever arguments you like:
Response.Write(SomeArgs('one' , 'two', 'three'));
Response.Write('<br>');
Response.Write(SomeArgs(1, 2, 3, 4, 5, 6, 7, 8));
// Displays this:
// onetwothree
// 12345678
%>
Comments