jQuery+html5点击刷新换一个验证码

 时间:2026-02-15 17:36:31

1、新建html文档。

jQuery+html5点击刷新换一个验证码

2、书写hmtl代码。

<div class="ddetails-header">

<div class="ddetails-con">

<div class="J_before">

<input type="button" value="Click" class="btn J_download">

</div>

<div class="J_after" style="display:none;">

<input type="hidden"  id="J_down">

<div class="checkcode">

<input type="text" id="J_codetext" placeholder="Type Here" maxlength="4">

<canvas class="J_codeimg" id="myCanvas" onclick="createCode()">jQuery+html5点击刷新换一个验证码</canvas>

</div>

<input type="button" value="Submit" class="btn-code" onClick="validate();">

<input type="button" value="Cancel" class="btn-code btn-no">

</div>

</div>

</div>

jQuery+html5点击刷新换一个验证码

3、书写css代码。

body { padding: 0; margin: 0; border: 0; color: #585858; font-size: 14px; }

h1, h2, ul, li, input { margin: 0; padding: 0; border: none; list-style: none; text-decoration: none; }

.ddetails-header { width: 100%; height: 700px; padding-top: 45px; background: #dff2ff; }

.ddetails-con { margin: 190px auto; width: 960px; height: 278px; }

.btn { float: left; display: block; text-align: center; text-decoration: none; list-style: none; vertical-align: middle; margin-top: 12px; margin-right: 21px; width: 120px; height: 42px; line-height: 42px; background: #008cff; border-radius: 3px; color: #fff; font-size: 16px; }

.checkcode { float: left; margin-top: 10px; width: 182px; height: 42px; border: 1px solid #008cff; border-radius: 3px; background: #fff; }

.checkcode input { float: left; text-align: center; width: 85px; height: 36px; padding: 3px; color: #000; }

.checkcode canvas { float: right; width: 85px; height: 36px; padding: 3px; }

.btn-code { margin-top: 10px; display: block; float: left; width: 95px; height: 42px; margin-left: 20px; background: #008cff; color: #fff; border-radius: 3px; }

.btn-no { background: none; border: 1px solid #008cff; border-radius: 3px; color: #008cff; }

.btn:hover { text-decoration: none; cursor: pointer; }

jQuery+html5点击刷新换一个验证码

4、书写并添加js代码。

<script src="jquery-1.9.1.min.js"></script>

<script src="index.js"></script>

jQuery+html5点击刷新换一个验证码

5、代码整体结构。

jQuery+html5点击刷新换一个验证码

6、查看效果。

jQuery+html5点击刷新换一个验证码

  • #我来了#用jquery实现点击button隐藏和显示div
  • 如何修改myeclipse快捷键
  • phpStudy修改根目录
  • css设置div四边框样式
  • 如何查找到css中element.style
  • 热门搜索
    四川旅游学院 国外旅游 武夷山旅游 湖南旅游 泰山旅游攻略 川西旅游 漳州旅游必去十大景点 贵州旅游景点 51旅游 杭州旅游攻略