验证通过或失败
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script type="text/javascript">
window.onload = function (){
var oText = document.getElementById('text1');
var oBtn = document.getElementById('btn1');
oBtn.onclick = function(){
if (oText.value == '') {
alert('请输入验证码');
} else if (oText.value == '方泽文是猪') {
alert('验证成功');
} else if (oText.value == '李芳芳最美') {
alert('验证成功');
} else {
alert('验证失败');
}
}
}
</script>
</head>
<body>
通过口令:
<input id="text1" type="text" />
<input id="btn1" type="button" value="验证" />
</body>
</html>