HTC application instance in CSS

Source: Internet
Author: User

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.

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.