TP大神帮我看看,验证码不能刷新,。JS有问题吗?
<script><br /> //验证码生成 <br /> var captcha_img = $('#captcha-container').find('img') <br /> var verifyimg = captcha_img.attr("src"); <br />captcha_img.attr('title', '点击刷新'); <br />captcha_img.click(function(){ <br /> if( verifyimg.indexOf('?')>0){ <br /> $(this).attr("src", verifyimg+'&random='+Math.random()); <br /> }else{ <br /> $(this).attr("src", verifyimg.replace(/\?.*$/,'')+'?'+Math.random()); <br /> } <br /> }); <br /> </script>
<p class="clearfix" id="captcha-container"><br /> <label class="one" for="agent">验证码:</label><br /> <input style="width:15%;" id="agent" name="verify" type="text" class="captcha-text" value placeholder="请输入验证码" /><br /> <img width="25%" class="left15" style="max-width:90%" alt="验证码" src="{:U('Home/Index/verify_c',array())}" title="点击刷新"><br /> </p>