TP experts help me see, the verification code cannot be refreshed ,. Is there a problem with JS? & Lt; script & gt; & nbsp; verification code generation & nbsp; var & nbsp; captcha_img & nbsp; $ (# captcha-container ). find (img) & nbsp; var & nbsp; verifyimg & nbs TP help me to see if the verification code cannot be refreshed ,. Is there a problem with JS?
Script
// Verification code generation
Var captcha_img = $ ('# captcha-INER'). find ('IMG ')
Var verifyimg = captcha_img.attr ("src ");
Captcha_img.attr ('title', 'Click refree ');
Captcha_img.click (function (){
If (verifyimg. indexOf ('? ')> 0 ){
$ (This). attr ("src", verifyimg + '& random =' + Math. random ());
} Else {
$ (This). attr ("src", verifyimg. replace (/\?. * $/, '') + '? '+ Math. random ());
}
});
Script
Verification code:
------ Solution ----------------------
First, make sure that the address Home/Index/verify_c can be refreshed and changed to a verification code.
Second, will your address be automatically assigned? Random = 2 to/random/2.
------ Solution ----------------------
I didn't see the onclick code of the img click event. will TP be generated for you?
Please check in the source code of the browser page
------ Solution ----------------------
First, check whether the loaded URL can generate a verification code normally. then, check whether the js code can properly load the click event by img. Finally, click to refresh.
------ Solution ----------------------
First, use firebug to check if any js error is reported, and then track it in the click event step by alert ('test ').