デザインフォルダーにあるログイン用の次のlogin.htmlページがあります。
<html>
<head>
<title>Login Page</title>
<script src="../Script/login.js">
</script>
</head>
<body>
<h3> Login</h3>
<form name="login">
Location code : <select name="ddl1"><br>
<option value="loc1" size=20>LH</option>
<option value="loc2">AT</option>
<option value="sel" selected>-------select------</option>
</select>
<br><br>
Enter UserName : <input type="Text" name="inp1" size=20><br><br>
Enter Password : <input type="password" name="pwd1" size=20><br><br>
<button type="button" name="login" onclick="log()">Login</button>
</form>
</body>
</html>
また、次のlogin.jsファイルを含むscriptsという名前の別のフォルダーがあります
function log()
{
var li=parent.head.document.getElementById('lin');
var lo=parent.head.document.getElementById('lou');
var passid = document.login.pwd1.value;
var passid_len = passid.length;
var un=document.login.inp1.value;
var e = document.getElementById("ddl1");
var strUser = e.options[e.selectedIndex].value;
if(strUser=="loc1" || strUser=="loc2")
{
if (passid_len >= 5)
{
if(un=="admin")
{
parent.nav1.location.href = 'nav_admin.html';
document.write("Hello admin");
li.style.display = "none";
lo.style.display = "";
}
else if(un=="clerec")
{
parent.nav1.location.href = 'nav_clerk_reception.html';
document.write("Hello reception clerk");
li.style.display = "none";
lo.style.display = "";
}
else if(un=="cledep")
{
parent.nav1.location.href = 'nav_clerk_departemnt_operations.html';
document.write("Hello dept clerk");
li.style.display = "none";
lo.style.display = "";
}
else if(un=="guest")
{
parent.nav1.location.href = 'nav_guest.html';
document.write("Hello Guest");
li.style.display = "none";
lo.style.display = "";
}
else
{
document.write("Wrong user name and password");
}
}
else
{
document.write("password should be minimum 5 characters");
}
}
else
{
document.write("Choose Location");
}
}
function fnlog1()
{
var lo=parent.head.document.getElementById('lou');
var li=parent.head.document.getElementById('lin');
lo.style.display = "none";
li.style.display = "";
parent.nav1.location.href = 'navigate.html';
}
ボタンをクリックしlog in
ても何も機能しません....リダイレクトは行われません....htmlページはlog()
関数を呼び出しません....