When we refresh the content in the form, we are used to using cookies. However, this is really troublesome. The behavior in CSS solves this problem well.
For example:
<Input style = "behavior: URL (# default # savehistory) "Name =" youname "type =" text "id =" yourname "size =" 10 "AutoComplete =" off ">
The above is the frequently used behavior function, and there are many other features.
Behavior syntax is:
Syntax:
Behavior: URL (URL) | URL (# objid) | URL (# default # behaviorname)
Valid value:
URL: use an absolute or relative URL to specify the DHTML behavior component (. HTC)
URL (# objid): Binary implementation (as ActiveX Control) behavior. # Objid indicates the ID attribute value of the object.
URL (# default # behaviorname): the default behavior of IE. Specified by the behavior name (# behaviorname)
Description: sets or retrieves the DHTML behavior of an object. Multiple actions are separated by spaces.
When multiple actions appended to the same element conflict, the result is determined by the order in which the behavior is applied to the element. The priority of the next behavior is higher than that of the previous one. For example, if multiple actions are used to set the object color, the result is determined by the last action applied to the element. The same rule applies to name conflicts between attributes, events, and methods provided by different behaviors.
You can use the addbehavior method to dynamically attach behavior to an object.
This attribute is read-only for currentstyle objects. Other objects can be read and written.
Be sure to use the behavior attribute of the style sheet (CSS) to inline define or use the addbehavior method to attach the behavior will not be automatically detached when the object is removed from the document tree. The style sheet rule defined in the document will be automatically detached when the object is removed from the document tree.
The corresponding script feature is behavior. Example: P {behavior: URL (# default # download );}
Div {behavior: URL (fly. HTC) URL (shy. HTC );}
Div {behavior: URL (# myobject );}
Application 1: refresh and retain the text in the input box
. Shistory {}{ behavior: URL (# default # savehistory );}
Application 2: Call the script
<HTML>
<Head>
<Style>
H1 {behavior: URL (behave. HTC )}
</Style>
</Head>
<Body>
<H1> place the mouse here </Body>
</Html>
Behave. HTC
<Component>
<Attach for = "element" event = "onmouseover"
Handler = "hig_lite"/>
<Attach for = "element" event = "onmouseout"
Handler = "low_lite"/>
<SCRIPT type = "text/JavaScript">
Function hig_lite ()
{
Element. style. Color = 255
}
Function low_lite ()
{
Element. style. Color = 0
}
</SCRIPT>
</Component>