<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<style type="text/css">
*{padding: 0;margin: 0;}
#img{position: absolute;}
</style>
</head>
<body>
<img id="img" src="img/xi.png">
<script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>
<script type="text/javascript"> function ArgTest(a,b){
var i,s = "The ArgTest function expected";
//实际传入的参数个数
var numargs = arguments.length;
//期望的参数个数
var expargs = ArgTest.length;
alert(numargs+","+expargs);
for(i = 0;i<numargs;i++){
s += "\n Arg "+ i + "="+arguments[i]+"";
}
alert(s);
} function test1(a,b,c){
//期望的参数个数
alert(test1.length)
}
function callerDemo(){
//本函数对象callee
alert(arguments.callee.name)
//被调用的函数的信息
if(callerDemo.caller){
var a = callerDemo.caller.toString();
var namestr = callerDemo.caller.name;
// debugger;
alert(namestr);//handlecaller
}else{
alert("this is a top function")
}
}
function handlecaller(){
callerDemo();
}
handlecaller();
// ArgTest(1,2);
// test1();
</script>
</body>
</html>
arguments
对象代表正在执行的函数和调用它的函数的参数。