Use Ajax and Js in ASP. NET to automatically update verification Codes ASP X:
<Asp: Image id = "image1" runat =" Server "Imageurl =" GIF. aspx ">
You can change it to an HTML control:
CS:
Image1.attributes. Add ("Alt", "cannot see clearly, change image ");
Image1.attributes. Add ("style", "cursor: hand ;");
Image1.attributes. Add ("onclick", "changevcode ();");
JS:
Function changevcode ()
{
VaR CBO = new callbackobject (); // callbackobject is a self-written Ajax object
VaR gifurl = "GIF. aspx"; // The image page for generating the verification code
VaR imgid = Document. getelementbyid ("<% = This. image1.clientid %> ");
Imgid. src = "/images/loading_16.gif"; // The loading image displayed during loading
Document. getelementbyid ("cCode"). value = ""; // clear the input box
CBO. oncomplete = onchangecomplete;
CBO. onerror = cbo_error;
CBO. docallback (gifurl );
}
Function onchangecomplete ()
{
VaR imgid = Document. getelementbyid ("<% = This. image1.clientid %> ");
Imgid. src = "GIF. aspx ";
}