MVC前台页面中,重新获取图片验证码的第二种方式:(前端页面代码如下,后台页面请参考上一篇文章)
---------html
<td> <img id="imgValidate" src="/Account/GetValidateCode" align="top" style="width:65px"> <a href="javascript:void();" target="_blank" class="baidu-highlight" onclick="ReFresh()">点击刷新验证码</a> </td>
--------JavaScript
function ReFresh() { var valiCode = document.getElementById("imgValidate"); valiCode.src = "/Account/GetValidateCode?time=" + Math.random() * 1000; //document.getElementById("imgValidate").src = "/Account/GetValidateCode?rn=" + Math.random() * 1000; }
时间: 2024-10-16 14:44:30