20130323【Java Script】パスワード入力によるページ移動
お題
プロンプトにパスワードを入力して、ページ移動をする。
■ソース
<html>
<head>
<script>
var password;
password = prompt("Please enter password","");
if (password == "password"){
location.href = "success.html";
} else {
alert("Password is invalid");
}
</script>
</head>
<body></body>
</html>
<ポイント>
location.href = "success.html";
これでsuccess.htmlにアクセスする。
以上