gpt4 book ai didi

javascript - 如何在不重新加载页面的情况下重新加载验证码

转载 作者:行者123 更新时间:2023-11-28 03:27:00 24 4
gpt4 key购买 nike

<img id="imgCaptcha" src="SandCaptcha.aspx?CHA=0azSeOdr7S7gTkFxtL6/5B6h2vj+naZnDR5jl/dvceoJHNXcooHfP2MkoWxPRVWvdK7NJHckH" style="height:60px;width:160px;">
  (function() {
'use strict';
function atualiza() {
document.querySelector('.captcha').addEventListener('click', function() {
alert('yolo');
var id = imgCaptcha();
this.setAttribute('src', 'SandCaptcha.aspx?id=' + id);
});

我试过了,但没用。

如何在 JavaScript 的帮助下重新加载此验证码图像而不重新加载页面?

最佳答案

尝试将 ?t='+new Date().getTime() 添加到您的 setAttribute 中。 this.setAttribute('src', 'SandCaptcha.aspx?id=' + id + '?t='+new Date().getTime()); 这应该强制图像重新加载使用缓存。

关于javascript - 如何在不重新加载页面的情况下重新加载验证码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58546840/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com