Tool Tip示例 (htc版)
<!--sample.htm-->
<!--alt.htc-->
<style>
.altT{ behavior:url(alt.htc); }
</style>
<body>
<div class=altT alt="hello word">on mouseover show me </div>
.altT{ behavior:url(alt.htc); }
</style>
<body>
<div class=altT alt="hello word">on mouseover show me </div>
<!--alt.htc-->
<public:component>
<public:attach event="oncontentready" onevent="fnInit()" />
<script language="Javascript">
var oTitleDIV;
function fnInit(){
var o=element;
if(!window.document.getElementById("htc_PopLayer")){
var oTitle="<div id='htc_PopLayer' style='position:absolute;left:0;color:#333333;background:#ffffcc;border-TOP:3px #333333 solid;font-size:9pt;padding:2;filter:blendTrans(Duration=0.5) progid:DXImageTransform.Microsoft.Shadow(color=#666666,direction=135,strength=2);visibility:hidden'></div>";
window.document.body.insertAdjacentHTML("beforeEnd",oTitle);
}
o.attachEvent("onmouseover",function(){Baction("over")});
o.attachEvent("onmouseout",function(){Baction("out")});
}
function Baction(action){
var o=element;
var oTitleDIV=window.document.getElementById("htc_PopLayer");
if(o.alt!=null&&o.alt!="")o.htc_bTitle=o.alt,o.alt="";
if(o.title!=null&&o.title!="")o.htc_bTitle=o.title,o.title="";
if(action=="over"){
var nLeft=0;
var nTop=0;
var nScrollLeft=window.document.body.scrollLeft;
var nScrollTop=window.document.body.scrollTop;
oTitleDIV.innerHTML=o.htc_bTitle;
bTrans(oTitleDIV,"visible");
if(window.document.body.clientWidth-event.x>oTitleDIV.offsetWidth){
nLeft=event.x+nScrollLeft;
}
else{
nLeft=event.x+nScrollLeft-oTitleDIV.offsetWidth;
}
if(window.document.body.clientHeight-event.y>oTitleDIV.offsetHeight){
nTop=event.y+nScrollTop;
}
else{
nTop=event.y+nScrollTop-oTitleDIV.offsetHeight;
}
oTitleDIV.style.pixelLeft=nLeft;
oTitleDIV.style.pixelTop=nTop;
}
if(action=="out"){
bTrans(oTitleDIV,"hidden");
}
}
function bTrans(_obj,_action){
_obj.filters.blendTrans.apply();
_obj.style.visibility=_action;
_obj.filters.blendTrans.play();
}
</script>
</public:component>
<public:attach event="oncontentready" onevent="fnInit()" />
<script language="Javascript">
var oTitleDIV;
function fnInit(){
var o=element;
if(!window.document.getElementById("htc_PopLayer")){
var oTitle="<div id='htc_PopLayer' style='position:absolute;left:0;color:#333333;background:#ffffcc;border-TOP:3px #333333 solid;font-size:9pt;padding:2;filter:blendTrans(Duration=0.5) progid:DXImageTransform.Microsoft.Shadow(color=#666666,direction=135,strength=2);visibility:hidden'></div>";
window.document.body.insertAdjacentHTML("beforeEnd",oTitle);
}
o.attachEvent("onmouseover",function(){Baction("over")});
o.attachEvent("onmouseout",function(){Baction("out")});
}
function Baction(action){
var o=element;
var oTitleDIV=window.document.getElementById("htc_PopLayer");
if(o.alt!=null&&o.alt!="")o.htc_bTitle=o.alt,o.alt="";
if(o.title!=null&&o.title!="")o.htc_bTitle=o.title,o.title="";
if(action=="over"){
var nLeft=0;
var nTop=0;
var nScrollLeft=window.document.body.scrollLeft;
var nScrollTop=window.document.body.scrollTop;
oTitleDIV.innerHTML=o.htc_bTitle;
bTrans(oTitleDIV,"visible");
if(window.document.body.clientWidth-event.x>oTitleDIV.offsetWidth){
nLeft=event.x+nScrollLeft;
}
else{
nLeft=event.x+nScrollLeft-oTitleDIV.offsetWidth;
}
if(window.document.body.clientHeight-event.y>oTitleDIV.offsetHeight){
nTop=event.y+nScrollTop;
}
else{
nTop=event.y+nScrollTop-oTitleDIV.offsetHeight;
}
oTitleDIV.style.pixelLeft=nLeft;
oTitleDIV.style.pixelTop=nTop;
}
if(action=="out"){
bTrans(oTitleDIV,"hidden");
}
}
function bTrans(_obj,_action){
_obj.filters.blendTrans.apply();
_obj.style.visibility=_action;
_obj.filters.blendTrans.play();
}
</script>
</public:component>