<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>随机验证码(带干扰线)</title>
</head>
<body>
<div>
<label>请输入验证码:</label><input id="YZ" name="yz" width="30px;" max="4">
<div id="vCodeImg" style="width: 100px"></div>
<button onclick="createCode()">确认</button>
</div>
</body>
<script>
(function (window, document) {
function GVerify(options) {
//创建一个图形验证码对象,接收options对象为参数
this.options = {
//默认options参数值
id: "", //容器Id
canvasId: "verifyCanvas", //canvas的ID
width: "100", //默认canvas宽度
height: "30", //默认canvas高度
type: "blend", //图形验证码默认类型blend:数字字母混合类型、number:纯数字、letter:纯字母
code: ""
}
if (Object.prototype.toString.call(options) == "[object Object]") {
//判断传入参数类型
for (var i in options) {
//根据传入的参数,修改默认参数值
this.options[i] = options[i];
}
} else
随机验证码(带干扰线)并校验提示
最新推荐文章于 2024-08-21 14:09:37 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)