tp5 uses ajax to realize verification code refresh and click no response
杨云雷
杨云雷 2018-08-13 14:52:03
0
4
1461

The following is part of the html verification code

<div class="row cl">
        <div class="formControls col-xs-8 col-xs-offset-3">
         <input class="input-text size-L" type="text" placeholder="验证码" onblur="if(this.value==''){this.value='验证码:'}" onclick="if(this.value=='验证码:'){this.value='';}" value="验证码:" style="width:150px;">
            <img id="verify_img" src="{:captcha_src()}" onclick="this.src=this.src"> <a id="kanbuq" href="javascript:refreshVerify;">看不清,换一张</a>
</div>
</div>

javacript

<!-- <script>
    // 用下面方法点击刷新无反应
    function refreshVerify() {
        var ts = Date.parse(new Date())/1000;
        $('#verify_img').attr("src", "/captcha?id="+ts);
    }
</script> -->
<script>
    //在家里用这个方法可以实现点击文字刷新,在单位电脑上依然无任何反应
    function refreshVerify() {
        var ts = Date.parse(new Date())/1000;
        var img = document.getElementById('verify_img');
        img.src = "{:captcha_src()}";
    }
</script>

May I ask why this is! ! ! ! Solve

杨云雷
杨云雷

reply all(3)
尓於我適

Brother, I have the same problem, can you help me answer it


杨云雷

It has been solved, no need to reply again

You bad bad

I don’t quite understand, but how do you trigger your js?

  • reply Click if you can’t see clearly and change to another one to trigger data-href="javascript:refreshVerify; This is from my teacher Zhu’s tutorial. I am also looking for ajax courses.
    杨云雷 author 2018-08-15 09:59:39
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template