XML <Prefix: CustomTag ID=sID STYLE="behavior:url('#default#userData')" />
HTML <ELEMENT STYLE="behavior:url('#default#userData')" ID=sID>
Scripting object.style.behavior = "url('#default#userData')"
object.addBehavior ("#default#userData")
Possible Values
Prefix Prefix that associates the CustomTag with an XML namespace. This prefix is set using the XMLNS attribute of the HTML tag.
CustomTag User-defined tag.
sID String that specifies a unique identifier for the object.
Members Table
The following table lists the members exposed by the userData object. Click a tab on the left to choose the type of member you want to view.
Attributes/Properties
Show:
Attributes/Properties
Methods
Method Description
getAttribute Retrieves the value of the specified attribute.
load Loads an object participating in userData persistence from a UserData store.
removeAttribute Removes the specified attribute from the object.
save Saves an object participating in userData persistence to a UserData store.
setAttribute Sets the value of the specified attribute.
Property Description
expires Sets or retrieves the expiration date of data persisted with the userData behavior.
XMLDocument Retrieves a reference to the XML Document Object Model (DOM) exposed by the object.
Attributes/Properties
Methods
Remarks
Security Alert For security reasons, a UserData store is available only in the same directory and with the same protocol used to persist the store.
Security Alert Using this behavior incorrectly can compromise the security of your application. Data in a UserData store is not encrypted and therefore not secure. Any application that has access to the drive where UserData is saved has access to the data. Therefore, it is recommended that you not persist sensitive data like credit card numbers. For more information, see Security Considerations: DHTML and Default Behaviors.
The userData behavior persists information across sessions by writing to a UserData store. This provides a data structure that is more dynamic and has a greater capacity than cookies. The capacity of the UserData store depends on the security zone of the domain. The following table shows the maximum amount of UserData storage that is available for an individual document and also the total available for an entire domain, based on the security zone.
Security Zone Document Limit (KB) Domain Limit (KB)
Local Machine 128 1024
Intranet 512 10240
Trusted Sites 128 1024
Internet 128 1024
Restricted 64 640
The userData behavior persists data across sessions, using one UserData store for each object. The UserData store is persisted in the cache using the save and load methods. Once the UserData store has been saved, it can be reloaded even if Microsoft® Internet Explorer has been closed and reopened.
Setting the userData behavior class on the html, head, title, or style object causes an error when the save or load method is called.
The required style can be set inline or in the document header, as follows:
An ID is optional for userData, but including one improves performance.
The userData behavior is available as of Internet Explorer 5, in the Microsoft Win32® and Unix platforms.
Examples
This example uses the userData behavior to preserve information in a UserData Store.
Show Example
<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>
Show Me
The following example uses the userData behavior in a custom tag to preserve information in a UserData Store.
[ Object Name ]
Platform Version
Win32:
Unix:
Version data is listed when the mouse hovers over a link, or the link has focus.
A, ACRONYM, ADDRESS, AREA, B, BIG, BLOCKQUOTE, BUTTON, CAPTION, CENTER, CITE, CODE, DD, DEL, DFN, DIR, DIV, DL, DT, EM, FONT, FORM, hn, HR, I, IMG, INPUT type=button, INPUT type=checkbox, INPUT type=file, INPUT type=hidden, INPUT type=image, INPUT type=password, INPUT type=radio, INPUT type=reset, INPUT type=submit, INPUT type=text, KBD, LABEL, LI, LISTING, MAP, MARQUEE, MENU, OBJECT, OL, OPTION, P, PLAINTEXT, PRE, Q, S, SAMP, SELECT, SMALL, SPAN, STRIKE, STRONG, SUB, SUP, TABLE, TEXTAREA, TT, U, UL, VAR, XMP
Move the mouse pointer over an element in the Applies To list to display availability information for the listed platforms. Internet Explorer does not expose this member on platforms that are not listed.
See Also
Introduction to DHTML Behaviors, Introduction to Persistence
draw 0,0,0,100
text "y轴",0,100
end sub
sub text(Str,x,y)
S.DrawingSurface.Text Str,x*4-200,y*-4+200
end sub
sub draw(x1,y1,x2,y2)
S.DrawingSurface.Line (x1*4)-200,(-4 * y1)+200,(x2*4)-200,(-4 * y2+200)
end sub
sub chart(str)
dim Arr
Arr = split(str,",")
text cint(Arr(0)) & "," & cint(Arr(1)),cint(Arr(0)),cint(Arr(1))
x=cint(Arr(0))
y=cint(Arr(1))
for i=2 to ubound(Arr)-1 step 2
draw x,y,cint(Arr(i)),cint(Arr(i+1))
text cint(Arr(i)) & "," & cint(Arr(i+1)),cint(Arr(i)),cint(Arr(i+1))
x=cint(Arr(i))
y=cint(Arr(i+1))
next
end sub
function makeStr(func)
dim str,x
for x=1 to 10
str = str & "," & x*10
str = str & "," & eval(func)
next
str = mid(str,2)
makeStr = str
end function
</SCRIPT>