Home  >  Article  >  Backend Development  >  A detailed look at XML behavior - the new DHTML?

A detailed look at XML behavior - the new DHTML?

黄舟
黄舟Original
2017-03-28 17:14:581744browse

Behavior (behavior) is a CSS attribute selector. It points to an XML file (htc) that contains special code and can change HTML page elements.

Behavior (Behavior) is not a W3C standard, it is just a Microsoft technology.

-------------------------------------------------- ----------------------------------

Behavior - What is behavior?
Behavior is a new CSS attribute

The behavior attribute can point to a separate XML file that contains script code that can change the elements or display styles of the XML or HTML page.

Do you understand? This is a way to completely separate the script program from the HTML page. This is great, now we can write some script libraries and connect them to any element we want.

-------------------------------------------------- ----------------------------------

How do behaviors work?
Look at the HTML file below. The behavior of the 4a249f0d628e2318394fd9b75b4636b1 element is defined in the c9ccee2e6ea535a969eb3f532ad9fe89 element:

<html>
<head>
<style>
h1 { behavior: url(behave.htc) }
</style>
</head>
<body>
<h1>Move your Mouse over me</h1>
</body>
</html>

The behavior code is stored in an XML document (behave.htc) as follows:

<component>
<attach for="element" event="onmouseover"
handler="hig_lite" />
<attach for="element" event="onmouseout"
handler="low_lite" />
<script type="text/javascript">
function hig_lite()
{
element.style.color=255
}
function low_lite()
{
element.style.color=0
}
</script>
</component>

This Behavior files contain JavaScript scripts. This script consists of 8c05085041e56efcb85463966dd1cb7e elements, which also contain scripteventoperators. It’s pretty, isn’t it?

The above is the detailed content of A detailed look at XML behavior - the new DHTML?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn