This example uses the userData behavior to preserve information in a UserData Store.HideExample<HTML>
<HEAD>
<STYLE>
.storeuserData {behavior:url(#default#userData);}
</STYLE>
<SCRIPT>
function fnSaveInput(){
var oPersist=oPersistForm.oPersistInput;
oPersist.setAttribute("sPersist",oPersist.value);
oPersist.save("oXMLBranch");
}
function fnLoadInput(){
var oPersist=oPersistForm.oPersistInput;
oPersist.load("oXMLBranch");
oPersist.value=oPersist.getAttribute("sPersist");
}
</SCRIPT>
</HEAD>
<BODY>
<FORM ID="oPersistForm">
<INPUT CLASS="storeuserData" TYPE="text" ID="oPersistInput">
<INPUT TYPE="button" VALUE="Load" onclick="fnLoadInput()">
<INPUT TYPE="button" VALUE="Save" onclick="fnSaveInput()">
</FORM>
</BODY>
</HTML>====CSDN====
无厘头冲动回帖

解决方案 »

  1.   

    先save再试Load,适用于页面转向、关闭ie再打开====CSDN====
    无厘头冲动回帖
      

  2.   

    使用cookieCookies
    The Cookies collection sets the value of a cookie. If the specified cookie does not exist, it is created. If the cookie exists, it takes the new value and the old value is discarded.Syntax
    Response.Cookies(cookie)[(key)|.attribute] = value 
     
    Parameters
    cookie 
    The name of the cookie. 
    key 
    An optional parameter. If key is specified, cookie is a dictionary, and key is set to value. 
    attribute 
    Specifies information about the cookie itself. The attribute parameter can be one of the following. Name Description 
    Domain Write-only. If specified, the cookie is sent only to requests to this domain. 
    Expires Write-only. The date on which the cookie expires. This date must be set in order for the cookie to be stored on the client's disk after the session ends. If this attribute is not set to a date beyond the current date, the cookie will expire when the session ends. 
    HasKeys Read-only. Specifies whether the cookie contains keys. 
    Path  Write-only. If specified, the cookie is sent only to requests to this path. If this attribute is not set, the application path is used. 
    Secure Write-only. Specifies whether the cookie is secure. 
    Value 
    Specifies the value to assign to key or attribute.
      

  3.   

    lunge() 
    你的save是存到哪里?
    oPersist.setAttribute("sPersist",oPersist.value);
    //这句是赋值到input中吧oPersist.save("oXMLBranch");
    //这句呢?
      

  4.   

    save Method
    --------------------------------------------------------------------------------
    Saves an object participating in userData persistence to a UserData store.userData.save(sStoreName)
    load Method
    --------------------------------------------------------------------------------
    Loads an object participating in userData persistence from a UserData store.userData.load(sStoreName)
    这里的用法类似ASP中的Session变量,参数sStoreName是自定义的
    ====CSDN====
    无厘头冲动回帖