In the past two days, I tried to write a Demo of AjaxToolkit: AsyncFileUpload. It has an OnClientUploadComplete attribute that can be associated with client JS, so I can write OnClientUploadComplete = "uploadComplete" and then define the uploadcomple:
Copy codeThe Code is as follows: function uploadComplete (sender, e ){
// Do something here...
}
But how can I obtain the information of the uploaded file from e? In addition to viewing the source code of AjaxControlToolkit, you can also use JS:Copy codeThe Code is as follows: function uploadComplete (sender, e ){
Var ret = "Properties: \ n ";
For (var prop in e ){
Var val = e [prop];
If (typeof (val) = "function "){
Ret + = (prop + "()");
}
Else {
Ret + = prop + ":" + val;
}
Ret + = "; \ n ";
}
Alert (ret );
}
Result:
In this way, you will understand.
The concept of "associated array" in JS is used here. Attributes of JS objects (including methods, or attributes) are stored in their associated arrays, through... in... you can traverse.
We can use the following link array:
Copy codeThe Code is as follows: var dog = new Object ();
Dog. id = 1;
Dog ["name"] = "Gougou ";
Alert ("id:" + dog ["id"] + ", name" + dog. name );
Get: "id: 1, name: Gougou"
This article is original. For more information, see: From Freeway -- cnBlogs.