JS实现验证码局部更新

JS页面
var checkcode=document.getElementById("checkcode");
checkcode.onclick=function(){
this.src='checkcode.php?tm='+Math.random(); //实现验证码局部刷新 checkcode.php为验证码文件
}

HTML应用验证码页面
<dd>验 证 码:<input type="text" name="checkCode" /><img src="checkcode.php" id="checkcode" alt="刷新"></img></dd>

原文地址:https://www.cnblogs.com/luodao1991/p/3153382.html