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?



Related Article

Alibaba Cloud 10 Year Anniversary

With You, We are Shaping a Digital World, 2009-2019

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.