XML 行为behavior 新的DHTML?
behavior是一个css属性选择器,他指向一个包含了特殊代码并且能够改变html页面元素的xml文件htc
行为behavior并不是w3c标准,他只是Microsoft的技术
behave.htc
<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>
//html文件验证
<html>
<head>
<style>
h1 { behavior: url(behave.htc) }
</style>
</head>
<body>
<h1>Move your Mouse over me</h1>
</body>
</html>
behavior是一个css属性选择器,他指向一个包含了特殊代码并且能够改变html页面元素的xml文件htc
行为behavior并不是w3c标准,他只是Microsoft的技术
behave.htc
<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>
//html文件验证
<html>
<head>
<style>
h1 { behavior: url(behave.htc) }
</style>
</head>
<body>
<h1>Move your Mouse over me</h1>
</body>
</html>
本文介绍了使用XML Behavior (HTC) 文件来扩展CSS的功能,实现动态效果。通过实例展示了如何利用HTC文件为HTML元素添加鼠标悬停的高亮显示效果。
6308

被折叠的 条评论
为什么被折叠?



