用cookie来保存登陆信息
然后在页面二根据cookie来做判断

解决方案 »

  1.   

    说的很明白可是我是初学,cookie不知道怎么写啊
      

  2.   

    这种情况我一般用Session登陆页:
    登陆成功:Session["UserName"]=username在第二页判断:
    if(Session["UserName"]!=null)
    {
    账号=Session["UserName"].ToString();
    }
      

  3.   

    帮忙给个cookie的例子怎么定义
    怎么保存信息
    在另一个页面又怎么取?
      

  4.   

    不用cookie,用传值也可以给你个我写的例子js部分
    a.htmlvar url = 'print.html?name='+name+'?price='+price+'?bigprice='+bigprice+'?money='+money+'?year='+year+'?month='+month+'?day='+day+'?bigyear='+bigyear+'?useful='+useful+'?bigmonth='+bigmonth+'?bigday='+bigday+'?addinform='+addinform;
        window.open(url);b.html
    window.onload = function(){
    document.getElementById("name").innerHTML = GetArgs(window.location.href,"name");
    //alert("参数为"+myname);
    document.getElementById("name2").innerHTML = GetArgs(window.location.href,"name");
    document.getElementById("price").innerHTML = GetArgs(window.location.href,"price");
    document.getElementById("bigprice").innerHTML = GetArgs(window.location.href,"bigprice");
    document.getElementById("money").innerHTML = GetArgs(window.location.href,"money");
    document.getElementById("year").innerHTML = GetArgs(window.location.href,"year");
    document.getElementById("month").innerHTML = GetArgs(window.location.href,"month");
    document.getElementById("day").innerHTML = GetArgs(window.location.href,"day");
    document.getElementById("bigyear").innerHTML = GetArgs(window.location.href,"bigyear");
    document.getElementById("bigmonth").innerHTML = GetArgs(window.location.href,"bigmonth");
    document.getElementById("bigday").innerHTML = GetArgs(window.location.href,"bigday");
    document.getElementById("useful").innerHTML = GetArgs(window.location.href,"useful");
    document.getElementById("use2").innerHTML = GetArgs(window.location.href,"useful");
    document.getElementById("addinform").innerHTML = GetArgs(window.location.href,"addinform");
    }
    function GetArgs(params,paramName){
        var argsIndex = params.indexOf("?");
    var arg = params.substring(argsIndex+1);
    args = arg.split("?");
    var valArg = "";
    for(var i =0;i<args.length;i++){
    str = args[i];
    var arg = str.split("=");
    if(arg.length<=1) continue;
    if(arg[0] == paramName){
    valArg = arg[1];
    }
        }
        return valArg;
    }
      

  5.   

    var url = 'print.html要跳转的页面自己改下
      

  6.   

    javascript是无法获得session的值的。session是存储在服务端的状态,在本地类似session的东西是cookie。
    是这样吧我这里只是很简单两个html页面
    一个打开另一个
    我只想把输入第一个页面的一个参数传给第二页面里的一个参数,这两个都是<input type="text" value="">
    没有服务器什么的
      

  7.   

    cookie 例子function setcookie(cookieName, cookieValue, expires, path, domain, secure) {
    document.cookie =
    escape(cookieName) + '=' + escape(cookieValue)
    + (expires ? '; expires=' + expires.toGMTString() : '')
    + (path ? '; path=' + path : '')
    + (domain ? '; domain=' + domain : '')
    + (secure ? '; secure' : '');
    };function getcookie(cookieName) {
    var cookieValue = '';
    var posName = document.cookie.indexOf(escape(cookieName) + '=');

    if (posName != -1) {
    var posValue = posName + (escape(cookieName) + '=').length;
    var endPos = document.cookie.indexOf(';', posValue);
    if (endPos != -1) cookieValue = unescape(document.cookie.substring(posValue, endPos));
    else cookieValue = unescape(document.cookie.substring(posValue));
    }
    return (cookieValue);
    };