日期:2014-05-16  浏览次数:20413 次

js获取Session问题

纯htm页面必须采用AJAX了,
ASP页面:var manager='<%=session("manager")%>',
ASPX页面:var manager='<%=Session["manager"]%>',
例如:用session来判断客户是否登录,
ASP页面:方法(1)manager.asp
??? <%
???? if not session("manager") then %>
??? <script language=javascript>
???????? alert("请先登录");
???????? window.navigate("index.htm");
??? </script>
?? <% end if
?? %>
show.asp
<!--#include file="manager.asp"-->
方法(2)show.asp
?<script language="javascript" type="text/javascript">
???? <!--
???????? function window.onload()
????????? {
??????????? var manager='<%=session("manager")%>';
??????????? if (manager!='true')
??????????? {
????????????? alert("请先登录");
????????????? window.navigate("index.htm");
???????????? }
??? ??? ? }
???? -->
?</script>