The HTC extension is. htc is written in DHTML and separated from the code and representation. apps on the network are rare. The following examples are provided in close-up for future reference.
Purpose:
When autoComplete = on is selected in the TextBox complete box, the onchange event may not be triggered if AUTOCOMPLETE is selected.
In addition, we need to be able to change the style in the hover and out events of the TextBox.
The Code is as follows:
First, add a file named Handle. htc.
The Code is as follows:
<PUBLIC: COMPONENT>
<PUBLIC: attach event = "onpropertychange" HANDLER = "onvaluechange"/>
<PUBLIC: attach event = "onmouseover" ONEVENT = "Hilite ()"/>
<PUBLIC: attach event = "onmouseout" ONEVENT = "Restore ()"/>
<SCRIPT>
Function onvaluechange ()
{
If ("value" = event. propertyName)
{
Element. fireEvent ("onchange ");
}
}
Function Hilite ()
{
Element. style. border = "1px # f60 solid ";
Element. style. background = "# f5f5f5 ";
}
Function Restore ()
{
Element. style. border = "1px # ccc solid ";
Element. style. background = "# fff ";
}
</SCRIPT>
</PUBLIC: COMPONENT>
Step 2: add style to TextBox
Code "onpropertychange", "dosomething (this )");
TextBox1.Style. Add ("behavior", "url (Handle. htc);"); // vs2005
In the above Code, the first sentence is to add an onpropertychange event, and the second sentence is to add a Style
It's easy.