zoukankan      html  css  js  c++  java
  • main.js常用的方法

     1 var getLocalhost = "xxxxx"; // ip名
     2 /**
     3  * 判断当前页面是否是login页面
     4  * 如果当前页面中sessionStorage.UserSession不存在 
     5  * 跳转到login页面
     6  */
     7 if(window.location.pathname.indexOf("login.html") == -1) {
     8     if(!sessionStorage.ADMINUSERSESSION) {
     9         var num = Math.ceil(Math.random() * 100000000);
    10         window.location.href = "login.html?_hbt=" + num;
    11     }
    12 }
    13 /**
    14  * 获取url后面的参数
    15  */
    16 function getRequest() {
    17     var url = location.search; //获取url中"?"符后的字串
    18     var theRequest = new Object();
    19     if(url.indexOf("?") != -1) {
    20         var str = url.substr(1);
    21         strs = str.split("&");
    22         for(var i = 0; i < strs.length; i++) {
    23             theRequest[strs[i].split("=")[0]] = (strs[i].split("=")[1]);
    24         }
    25     }
    26     return theRequest;
    27 }
    28 // 使用方法,获取url参数为id的值
    29 // getRequest().id;
    30 /**
    31  * 退出登录
    32  */
    33 function quit() {
    34     sessionStorage.removeItem('ADMINUSERSESSION');
    35     var num = Math.ceil(Math.random() * 100000000);
    36     window.location.href = "login.html?_hbt=" + num;
    37 }
  • 相关阅读:
    Django-序列化器
    HTTP请求头响应头的信息
    HTTP协议
    IAAS,PAAS,SAAS
    MySQL-部分名词解释
    MySQL-事务和特性
    用Java仿QQ界面聊天小项目
    25篇Java入门技术博客,送给准备入坑的你
    Java自学推荐书籍
    Java中的并发讲解
  • 原文地址:https://www.cnblogs.com/yaowan/p/9540683.html
Copyright © 2011-2022 走看看