我的问题:单击提交按钮后,文档没有从 else if 语句加载 nsfw.html(不要评判我!):
Jsfiddle:jsfiddle.net/tKeYf/
但我想它在那里不起作用,所以我将它上传到我的主机:这里
HTML:
<form>
<input placeholder="Age" maxlength="3" size="3" type="text">
<input type="submit" value="Okay">
</form>
JavaScript:
$(document).ready(function () {
// verification
$('title').html('jQuery`s working!');
// submit
$('input[type=submit]').click(function () {
var a = $('input[type=text]').val();
if (a == '') {
alert('Enter Your Age!');
} else if (a < 18) {
alert('You Shall Not Pass!');
} else if (a >= 18) {
alert('Welcome Aboard!');
// Here's the problem!
$('html').load('nsfw.html');
} else {
alert('Age Is A Number!');
}
});
});