转载地址:https://blog.csdn.net/Jiang_Rong_Tao/article/details/78063295
1、(看不清,换一张),点击刷新验证码
<img id="image1" src="http://localhost:8080/om/Ik" border="1" class="verifyimg" height="30px" width="120 px" "/>
<a href="#" οnclick="changeCode();">看不清,换一张</a><br/>
<script type="text/javascript">
function changeCode(){
var img=document.getElementById("image1");
img.src="http://localhost:8080/onlineExam/ImageChack?"+new Date().getTime();
}
</script>
2、点击验证码,即可刷新验证码的图片
<img id="image1" src="http://localhost:8080/om/Ik" border="1" class="verifyimg" height="30px" width="120 px" onClick="getcode(this)"/>
<script type="text/javascript">
function getcode() {
var randomnum = Math.random();
var img = document.getElementById("image1");
img.src = "http://localhost:8080/om/Ik?d=" + randomnum;
}