这是我的HTML
<div class="row">
<div class="form-group">
<label class="control-label col-sm-3"><font color="#FF0000">*</font><strong>Captcha</strong>
</label>
<div class="col-sm-3">
<?php echo '<img src="captcha.php" alt="captcha">'; ?>
<br/>
<span><input name="captcha_entered" type="text" class="form-control" id="captcha_entered" size="27" maxlength="4"/></br></span>
<input type="hidden" name="captcha_total" id="captcha_total" value="<?php echo $_SESSION['rand_code']; ?>">
</div>
</div>
</div>
<div> </div>
<div class="row">
<div class="col-sm-12">
<center>
<script type="text/javascript">
document.write("<input type=\"submit\" value=\"Submit\" class=\"btn1\"/>");
</script>
<noscript>
<p style="color: red;"><b><i>Please enable JavaScript to continue</i></b>
<p>
</noscript>
</center>
</div>
</div>
这是我的javascript
function q_form_val() {
var patt = new RegExp(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/);
var captcha_entered = document.getElementById("captcha_entered").value;
if (captcha_entered == "") {
alert("Please enter the Captcha");
return false;
}else if(!patt.test(captcha_entered)){
alert("Bad Captcha Match");
return false;
}
return true;
}
它还为正确的验证码和错误的验证码显示相同的弹出消息。 错误和严格的验证码显示与错误的验证码相同的错误。
右侧验证码有什么问题? 验证有什么问题?
答案 0 :(得分:0)
从中获得帮助。它会解决你的问题。明智地使用它
function myself() {
this.g = "";
this.h = [];
this.i = {};
myself.prototype = new parent();
myself.prototype.constructor = myself;
}
function parent() {
this.d = "";
this.e = [];
this.f = {};
parent.prototype = new grandParent();
parent.prototype.constructor = parent;
}
function grandParent() {
this.a = "";
this.b = [];
this.c = {};
}
var data = new myself();
var jsonData = {};
do {
for(var key in data) {
if(data.hasOwnProperty(key) && data.propertyIsEnumerable(key)) {
jsonData[key] = data[key];
}
}
data = Object.getPrototypeOf(data).constructor.prototype;
Object.defineProperties(data, {
'constructor': {
enumerable: false
}
});
} while (data.constructor.name !== "grandParent")
console.log(jsonData);