Javascript 如何在不重新加载页面的情况下重新加载验证码
我试过了,但没用Javascript 如何在不重新加载页面的情况下重新加载验证码,javascript,html,Javascript,Html,我试过了,但没用 在JavaScript的帮助下,如何在不重新加载页面的情况下重新加载此验证码图像?尝试将?t='+new Date().getTime()添加到您的setAttribute中this.setAttribute('src','SandCaptcha.aspx?id='+id+'?t='+new Date().getTime())这将强制重新加载映像,而不是使用缓存。尝试向setAttribute添加?t='+new Date().getTime()this.setAttribut
在JavaScript的帮助下,如何在不重新加载页面的情况下重新加载此验证码图像?
尝试将?t='+new Date().getTime()
添加到您的setAttribute中<代码>this.setAttribute('src','SandCaptcha.aspx?id='+id+'?t='+new Date().getTime())这将强制重新加载映像,而不是使用缓存。尝试向setAttribute添加?t='+new Date().getTime()
<代码>this.setAttribute('src','SandCaptcha.aspx?id='+id+'?t='+new Date().getTime())代码>这将强制重新加载图像,而不是使用缓存
<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);
});