当前位置:编程文档 >> XHTML >> IE与Firefox的HTC实现
首页

IE与Firefox的HTC实现

所属类别:XHTML
推荐指数:★★★★
文档人气:280
本周人气:4
发布日期:2007-1-26

test.htm

<style>
span {-moz-binding: url(test.xml#custom);behavior:url(test.htc);cursor:pointer;background:#ddd;}
</style>
<span> test </span>

//IE
test.htc

<attach event="onmouseup" onevent="up()"/>
<attach event="onmousedown" onevent="down()"/>
<script language="javascript">
var currX = 0;
function up(){
  alert(currX);
}
function down(){
  currX += 1;
}
</script>

//Firefox
test.xml

<?xml version="1.0"?>
<bindings xmlns="http://www.mozilla.org/xbl" xmlns:html="http://www.w3.org/1999/xhtml">
  <binding id="custom" styleexplicitcontent="true">
   <implementation>
    <property name="currX">0</property>
   </implementation>
   <handlers>
    <handler event="mousedown">
     this.currX = event.clientX+this.currX;
    </handler>
    <handler event="mouseup">
     alert(parseInt(this.currX));
    </handler>
   </handlers>
  </binding>
</bindings>

文档说明:

     

相关文档


读取评论列表……