Before Microsoft IE 5.0 version of the browser released, the biggest challenge in web programming is to easily create components to achieve the code reuse and multi-page sharing. This problem has been plaguing DHTML (dynamic HEML) web programming. They can only repeat the code from HTML, CSS, and JavaScript to meet the repetitive or similar functions on multiple pages. After the IE 5.0 browser is released, this situation has been improved, which brings us a new instruction combination method, which can encapsulate the code that implements a specific function in one component, so that the multi-page code is reused, so that web page programming Enter a new world. This new technology is what we have to talk about "Behaviors" in DHTML.
"Behavior" As a simple and easy-to-use component, it encapsulates a specific function or action on the page. When a "behavior" attached to one component in the web page, the original behavior of this component changes. Therefore, web programming can develop universal DHTML instructions and change some properties of the original object, with "behavior" to enhance the functionality of an object, and simplify the HTML code of the page. And "behavior" creation and use is also very simple and convenient, and the knowledge you need is just the CSS style sheet, HTML instruction, and JavaScript scripting language that have been used. As long as you know this, there is a practical programming experience, learning and mastering the use of "behavior" is completely no problem. We will explain how to write and use a "behavior" and experience "Behavior", and experience "Behavior" and experience "Behavior" and experience "behavior". First create a text file called Font_EffTce.htc, which makes up the "Behaviors" component, is the extension of .htc, the content in this file is our description of this "behavior". Its creation and use steps are as follows: (1) First add a few event responses to this "behavior", the statement writing format is as follows:
Regularly visiting Microsoft's MSDN documentation, especially for beginners is a good study habit, you can almost get any answers you want to find, its URL: http: //msdn.microsoft.com/ie/. The complete "behavior" document "font_effect.htc" is as follows: "Behavior" document start // Add four mouse events to "Behavior"