私の問題: 送信ボタンをクリックした後、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!');
}
});
});