学习ie5.5的Element Behaviors笔记

本文介绍了DHTML中的两种行为:attached behavior 和 element behavior 的概念及应用。详细解释了如何使用HTC文件来实现这些行为,并提供了具体的示例代码。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Element Behaviors is HTML component.    be written in script using an HTC file, or it can be implemented with a binary by using ATL technoligic.

分两种:

attached behaviorA DHTML behavior that binds asynchronously to standard HTML elements. It is possible to attach DHTML behaviors using the behavior attribute with CSS or by using the addBehavior method in script.
element behaviorA feature of Internet Explorer 5.5 that allows DHTML behaviors to be bound synchronously to a custom element. Custom elements bound to element behaviors can be used like any other element in an HTML document, ensuring that the functionality of the behavior is never removed from the element.

 

<PUBLIC:COMPONENT tagName="checkers">
<PUBLIC:PROPERTY NAME="boardWidth" />
<PUBLIC:METHOD name="newGame()" />
<PUBLIC:ATTACH event="onmouseover" onevent="mouseover()" />
</PUBLIC:COMPONENT>

<SCRIPT Language="Javascript">
function newGame(){
// insert code to initialize a new game here
}

function mouseover(){
// insert code to handle mouseover events
}
</SCRIPT>
<BODY>
</BODY>

 

The complete HTML file, which implements the checkers element, is shown below.

<HTML xmlns:games>
<HEAD>
<?IMPORT namespace="games" implementation="checkers.htc" >
</HEAD>
<BODY>
<games:checkers />
</BODY>
</HTML>

 

Lightweight HTC Files

It is often possible to write an HTC file that does not contain any static HTML, lightweight HTC is that the page loads much faster, especially when multiple instances of the same custom element are used.

<PUBLIC:COMPONENT tagName="rollover" lightweight = true >
</PUBLIC:COMPONENT
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值