<script language="JavaScript">
<!--
function tester(){
alert('你传了'+arguments.length.toString()+'个参数');
var s='参数依次是:\n';
for(var i=0;i<arguments.length;i++){
s+=arguments[i]+'\n';
}
alert(s);
} tester(1,2,3,4,5,6);
tester('aasda','sdasd',1,32,window);
-->
</script>

解决方案 »

  1.   

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/jscript7/html/jsproarguments.asparguments Property
    Returns the arguments object for the currently executing Function object.[function.]arguments
    Arguments
    function 
    Optional. The name of the currently executing Function object. 
    Res
    The arguments property allows a function to handle a variable number of arguments. The length property of the arguments object contains the number of arguments passed to the function. The individual arguments contained in the arguments object can be accessed in the same way array elements are accessed.Note   The arguments object is not available when running in fast mode, the default for JScript .NET. To compile a program from the command line that uses the arguments object, you must turn off the fast option by using /fast-. It is not safe to turn off the fast option in ASP.NET because of threading issues. For more information, see arguments Object.
    Example
    The following example illustrates the use of the arguments property. function argTest(){
       var s = "";
       s += "The individual arguments are:\n"
       for (var n=0; n< arguments.length; n++){
          s += "argument " + n;
          s += " is " + argTest.arguments[n] + "\n";
       }
       return(s);
    }
    print(argTest(1, 2, "hello", new Date()));
    After compiling this program with the /fast- option, the output of this program is:The individual arguments are:
    argument 0 is 1
    argument 1 is 2
    argument 2 is hello
    argument 3 is Sat Jan 1 00:00:00 PST 2000
    Requirements
    Version 2See Also
    Arguments Object | function StatementApplies To: Function Object