JavaScript与Servlet实现验证码
作者:互联网
验证码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>验证码</title>
<script>
window.onload = function (){
var img = document.getElementById("checkCode");
img.onclick = function(){
var date = new Date().getTime()
img.src = "/day13/checkCodeServlet?"+date;
}
}
function ReCheckCode(){
var img = document.getElementById("checkCode");
img.src = "/day13/checkCodeServlet?recheckCode"+Math.random();
}
</script>
</head>
<body>
<img id="checkCode" src="/day13/checkCodeServlet" alt=" 验证码"/>
<a id="refresh" href="#" onclick="ReCheckCode();">看不清,换一张</a>
</body>
</html>
标签:function,checkCode,img,JavaScript,验证码,checkCodeServlet,var,Servlet 来源: https://www.cnblogs.com/withLevi/p/14595788.html