自定义了一个验证码刷新函数,如下: //验证码刷新函数
function captchaRefresh() 
{
alert( "captchaRefresh" );
$( "#img-captcha" ).src = $( "#img-captcha" ).src +"?random="+ Math.random();
captchaIsTrue = false;

$( "#captcha" ).attr( "value", "" );
$( "#info" ).html( "请输入验证码" );
}
程序里在这两个地方调用了这段验证码刷新函数
此处的调用标记为① //验证码刷新事件
$( "#img-captcha" ).bind( "click", captchaRefresh );此处的调用标记为② //登陆验证-回调函数
function loginCallback( xml ) 
{
var output = $( xml ).find( "root" ).find( "result" ).text(); if( output == "登陆成功" )
{
location.href = "DrawCaptcha";
}
else
{
$( "#info" ).html( output );
captchaRefresh();
}
}-------------------------------------------------------------------------------------------------------①②都调用这段调用验证码刷新函数
都只弹出"captchaRefresh"的对话框,
$( "#img-captcha" ).src = $( "#img-captcha" ).src +"?random="+ Math.random();
这段图片刷新代码不起作用修改这段代码为:
this.src = this.src +"?random="+ Math.random();
①处可以刷新,②处不能,因为②处调用的this没有给定。要怎么改才能让两处都能刷新呢?
为什么
$( "#img-captcha" ).src = $( "#img-captcha" ).src +"?random="+ Math.random();
这样写不起作用呢?
本人初学,有很多不懂的地方…