zhengmacro's recent timeline updates
zhengmacro

zhengmacro

V2EX member #41781, joined on 2013-07-07 17:02:17 +08:00
zhengmacro's recent replies
Dec 25, 2018
Replied to a topic by wvvW 杭州 浙江移动省公司薪资和发展如何?
楼主是刚毕业还是换工作啊
Nov 23, 2016
Replied to a topic by cjjia 4G 蚂蚁大(小)宝卡,资费很良心啊
@spwei 老用户无缘什么鬼,这不是刚出的卡吗
Oct 19, 2016
Replied to a topic by dongweiming 推广 赠送几本《Python Web 开发实战》
87
性别女
Sep 27, 2016
Replied to a topic by zhengmacro Python 问个很蠢的爬虫验证码问题
@cheetah
@zongren
@crab
感觉天亮了,谢谢哈哈
Sep 27, 2016
Replied to a topic by zhengmacro Python 问个很蠢的爬虫验证码问题
js 是直接写在登录页面的,类似下面这个

var code; //在全局 定义验证码
function createCode() {
code = "";
var codeLength = 6;//验证码的长度
var checkCode = document.getElementById("checkCode");
var selectChar = new Array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9,'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');//所有候选组成验证码的字符,当然也可以用中文的

for (var i = 0; i < codeLength; i++) {
var charIndex = Math.floor(Math.random() * 36);
code += selectChar[charIndex];
}
//alert(code);
if (checkCode) {
checkCode.className = "code";
checkCode.value = code;
}
}

function validate() {
var inputCode = document.getElementById("input1").value;
if (inputCode.length <= 0) {
alert("请输入验证码!");
} else if (inputCode != code) {
alert("验证码输入错误!");
createCode();//刷新验证码
} else {
alert("^-^ OK");
}
}
About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3279 Online   Highest 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 15ms · UTC 14:13 · PVG 22:13 · LAX 07:13 · JFK 10:13
♥ Do have faith in what you're doing.