XML behavior-new DHTML?

Source: Internet
Author: User
Tags contains html page
Dhtml|xml

One behavior is a CSS property selector. It can point to an XML file that contains the opposite code that is executed against elements in a Web page. Behavior is not a standard for the consortium, it is a technology unique to Microsoft.
What is the behavior?
One behavior is a new CSS property selector. An action selector can point to a separate XML file that contains the opposite code that is executed by XML or HTML elements in a Web page. Do you understand me? Is it a way to completely remove the scripting code from the HTML page? That's great. Now we start by writing a script library and then attach the script to any element we choose.
How does it work?
Look at this HTML file. It has a < style> element that defines an behavior for the < h1> element:
< html>
< head>
< style>
H1 {Behavior:url (BEHAVE.HTC)}
</style>
< body>
< H1>move your Mouse over me</body>

Try this example yourself and move the mouse over the text. The behavior code is stored in the XML document BEHAVE.HTC, as follows:

< component>
< attach for= "element" event= "onmouseover"
handler= "Hig_lite"/>
< attach for= "element" event= "onmouseout"
handler= "Low_lite"/>


< script language= "JavaScript" >
function Hig_lite ()
{
element.style.color=255
}
function Low_lite ()
{
Element.style.color=0
}
</script>
</component>
This behavior file contains JavaScript. This script is wrapped in a < component> element. The element wrapper also contains the event operator for the script. It's a good act, isn't it?



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.