Javascript obtains the number of function parameters and the number of javascript parameters.
/*** Get the number of Function parameters * @ param {function} func [Function to be retrieved] * @ return {*} [array of parameters or undefind] */function getFuncParameters (func) {if (typeof func = 'function') {var mathes =/[^ (] + \ ([^)] *)? \)/Gm.exe c (Function. prototype. toString. call (func); if (mathes [1]) {var args = mathes [1]. replace (/[^, \ w] */g ,''). split (','); return args ;}}}
Javascript defines a function. How can I obtain a parameter triggered by this function?
The Code defines a "class", so you can save the tid value in the data member this. _ tid in the doubleclick method:
This. _ tid = tid;
Then, you can use this. _ tid directly in the cancle method. You do not need to input tid from the function call.
Javascript obtains the parameters or variables of another function from one function on this page.
Var s = 0;
Function sex (x ){
X = 1? S = "male": s = "female ";
}
Function user (){
Alert (s); // you can use the sex function to determine whether the name is male or female ";
}