学习ie5.5的Element Behaviors笔记

来源:互联网 发布:阿里云活体核验照片 编辑:程序博客网 时间:2024/05/17 14:26

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 behavior A 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 behavior A 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
原创粉丝点击