验证码缓存问题完美解决方案

在验证码页面后加一个随机的参数。这样历史记录里就不会有相同的请求了,也就不存在缓存的问题了。
代码如下:

<img id="imgvc" src="ValidateCode.aspx?t='+Math.round(Math.random()*1e17)'" onclick="getObject('imgvc').src='ValidateCode.aspx?t='+Math.round(Math.random()*1e17);" width="66" height="20" align="absmiddle" />

上面的要一个getObject(eleName);函数。。。。用这个就没问题了

<img id="imgvc" src="ValidateCode.aspx?t='+Math.round(Math.random()*1e17)'" onclick="document.getElementById('imgvc').src='ValidateCode.aspx?t='+Math.round(Math.random()*1e17);" width="66" height="20" align="absmiddle" />

原文地址:https://www.cnblogs.com/heys/p/483627.html