.net mvc验证码(混合字母数字+刷新)

务必请先注意这2点:

1.

要在<head></head>里面引用js  ,否则没有验证图片出来

  <script src="~/Scripts/jquery-1.8.2.min.js"></script>

 

 

2.

 <img id="GL_StandardCode" style="cursor: pointer;" src="@Url.Action("GetImg", "ValidateCode")?t=@DateTime.Now.Ticks" title="看不清,点击换一张" />

//<img>标签要放在<script></script>标签的面,否则无刷新功能

<script type="text/javascript">
$("#GL_StandardCode").click(function () {
var newSrc = "@Url.Action("GetImg", "ValidateCode")" + "?t=" + (new Date()).getTime();
this.src=newSrc;
return false;
});
</script>

 

3.附上别人写的验证码连接:https://www.cnblogs.com/xiaomaoau/p/9132183.html

 

posted @ 2019-02-24 20:47  风葬秋暝  阅读(363)  评论(0编辑  收藏  举报