Reprint: http://msdn.microsoft.com/zh-cn/library/h2ak8h2y (v=vs.94). aspx
Invokes the method of an object, replacing the current object with another object.
Call ([thisobj[, arg1[, arg2[, [, ArgN]]])
Parameters
Thisobj
Optional. The object that will be used as the current object.
Arg1, Arg2,, ArgN
Optional. The parameter list that will be passed to the method.
Note
The call method is used to invoke a method that represents another project. It allows you to change the function's this object from the initial context to the new object specified by Thisobj.
If the Thisobj parameter is not provided, the global object is used as the thisobj.
Example
The following code shows how to use the call method.
1 functioncallMe (arg1, arg2) {2Console.log (' This value: ' + This);3 for(varIinchcallme.arguments) {4Console.log (' arguments: ' +Callme.arguments[i])5 }6 }7 8CallMe (1, 2);9 //This value: [Object Window]Ten //arguments:1 One //Arguments:2 A -Callme.call (' A ', ' B ', ' C ') - //This value:a the //arguments:b - //Arguments:c
Requirements
Supported in the following document modes: Quirks, Internet Explorer 6 standard mode, Internet Explorer 7 Standard mode, Internet Explorer 8 standard mode, Internet Explorer 9 standard mode, INT Ernet Explorer 10 Standard mode and Internet Explorer 11 standard mode. In addition, it is also supported in store apps (Windows 8 and Windows Phone 8.1).
Call Method (Function) (JavaScript)