Ajax用户登录权限验证
本功能是在html页面中验证cookies或者session的存在。
<script language="javascript" type="text/javascript">
function check() {
//var username=document.getElementById("username");
var url = "1111.asp";
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
// xmlHttp=GetXmlHttpObject()
//
// if (xmlHttp==null)
// {
// alert ("您的浏览器不支持AJAX!");
// return;
// }
xmlHttp.open('post', url, true);
xmlHttp.onreadystatechange = function(){
if (xmlHttp.readyState == 4) {
//alert(xmlHttp.responseText);
//document.getElementById("show").innerHTML =decodeURI(xmlHttp.responseText);
if (xmlHttp.responseText==1){
//alert("您的权限不够!请登录。")
location.href='chinese/Login_dl.asp';
}
if (xmlHttp.responseText==0){
window.open("说明生成静态html的方法.rar","new","");
}
}
}
xmlHttp.setRequestHeader("Content-Type","text/html;charset=utf-8");
xmlHttp.send(null);
}
</script>
asp文件:
<%
response.Write "1"
%>
浙公网安备 33010602011771号