验证码

<img class="img-code" id="vcode" title="换一换" alt="加載中" src="接口" onclick='this.src="接口?v="+Math.random()'>

 初始化页面刷新一次

function refresh(){
  var vcode=document.getElementById('vcode');
  vcode.src ='/services/user/kaptcha.do?v='+Math.random();
};

refresh();

原文地址:https://www.cnblogs.com/CMing/p/6710122.html