<html>
<script type="text/javascript">
function logged()
{
<% session.setAttribute("logtype", "hire"); %>
var x=<%=session.getAttribute("loggedin")%>;
if(x===true)
{
window.location="home.jsp";
return false;
}
else if(x===false)
{
return true;
}
}
</script>
<body>
<form method="post" action="login.jsp" onsubmit="return logged()">
<input type="submit" value="HIRE"/>
</form>
<form method="post" action="displayTasks.jsp" onsubmit="<% session.setAttribute("logtype", "work"); %>">
<input type="submit" value="WORK"/>
</form>
</body>
</html>
我的会话变量“logtype”产生了问题。无论我点击什么,它都保持为“工作”。我究竟做错了什么?