<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> 最佳答案