TP大神帮我看看,验证码不能刷新,。JS有问题吗?

浏览:2159 发布日期:2015/06/02 分类:前端开发
<script>
//验证码生成  
var captcha_img = $('#captcha-container').find('img')  
var verifyimg = captcha_img.attr("src");  
captcha_img.attr('title', '点击刷新');  
captcha_img.click(function(){  
    if( verifyimg.indexOf('?')>0){  
        $(this).attr("src", verifyimg+'&random='+Math.random());  
    }else{  
        $(this).attr("src", verifyimg.replace(/\?.*$/,'')+'?'+Math.random());  
    }  
});  
</script>
 <p class="clearfix" id="captcha-container">
            <label class="one" for="agent">验证码:</label>
            <input style="width:15%;" id="agent" name="verify" type="text" class="captcha-text" value placeholder="请输入验证码" />
            <img width="25%" class="left15" height="50" alt="验证码" src="{:U('Home/Index/verify_c',array())}" title="点击刷新">
        </p>
最佳答案
评论( 相关
后面还有条评论,点击查看>>