6. Analyze let us see the work finished. We put the buttonstyleFlat.htc and Sample.html. We found that Button is flattened, and the mouse passes, removed, pressing the color while the color changes, and you can find that the script will find that we can Handle an onpush event and call the showMessage () method. All changes are from Style = 'Behavior: URL (ButtonStyleflat.htc)', a Behavior declaration. And don't write any scripts in HTML. We don't discuss the use of Behavior, just explain how to develop a complete HTC. A complete HTC consists of two parts: We call them API declarations and script implementations. The API declaration consists of the following parts: a. Public: Component This part consists of the outermost elements of HTC. Only define the included content is a component B. PUBLIC: Attach This section defines processing C which is for customer events. Public: Property's property definition d. Public: Event definition E of Event. Public: Method: Method Open Method Due to this text is just a TUTORAL, only the syntax used is analyzed, more specifications can refer to MSDN document: ms-help: //ms.msdnqtr.2004jan.1033/behavior/ networkShop/components/htc /Reference/htcref.htm (address may need to be modified) or online version: http://msdn.microsoft.com/Workshop/components/htc/reference/htcref.asp? frame = true (The following specification is based on IE5.0 and above) Version) PUBLIC: ATTACH Represents the Binding Event and Processing Procedure Event: Indicates the Event Handle Name Onevent: Indicates Procedure Name Public: Property Indicates the Property of the Open to Environment Name: Attribute Name Properties You can set readers similar to C # Property, respectively, GET and PUT processes. After setting the properties, you can use the HTML syntax to specify the attribute value of the component as any value.
Public: Method Open to Environment Name: Method Name PUBLIC: Event You can use the Environment CATCH Event Name: Event Name ID: Internal Reference Name Script Implementation API Declaration Only Components Open to Environment Programming Interfaces, need to use scripts in components To achieve internal logic. Script implementation has the following sections: 1. Define event processing 2. Define Property's picking process 3. Define specific implementation of Method 4. Define Event's rapid logic 5. Other internal processes in which Event is generally During other processes. The syntax of the script is different from the script on the ordinary HTML page. 7. Instance explanation The above Button Style Flat is very short, but can basically describe the central content of this article, that is, HTC programming idea. We then Look at the instances provided by: a. In the first line, we noticed that the onDocumentReady event handed over the onInit (ATTACH syntax). OctocumentReady is a unique event. Representative When the front end of the company HTML is fully loaded. It can be said that the onDocumentReady event is the process of Components initialization. In all HTC I wrote, ATTACH has this event. This habit I don't know when I started. Slowly I found that I can't leave OndocumentReady . As long as there is a similar initialization process in our HTC, we need to specify the procedure of the OndocumentReady time. In this instance, we initially configured the original style of Button during the processes bound by OnDocumentReady. That is, according to the Schema characteristics Button's appearance. B. Generally speaking, our Component is visible. And the main action interacting with the user in the HTML page is the action of the mouse. So, usually, we will always deal DEAL Five basic events of mouse Mouse over, Mouseout, Mouse Down, Mouse Up and Click. It is also a habit, I usually don't consider these five events. Even if the binding process is empty .c. Property, you can Define the GET and PUT processes to make attributes. In general, these two processes can be omitted. Unless the values are equipped with legality checks. D. Event triggered. PUBLIC: Event declared ID attribute for The internal reference of the Script section. When needed When this event, you only need to use similar: push.fire () command. The environment is to start preparing Catch this event. Pretty simple .E. Method implementation. Method Name Attribute directly represents the function name of the