鼠標懸浮註釋
//綁定事件:
dojo.connect(unieap.byId("GROUP_TYPE"), "onMouseOver", this, over);
dojo.connect(unieap.byId("GROUP_TYPE"), "onMouseOut", this, out);
//onmouseover 事件觸發的函數
function over(e, message){
cen.innerText = "雙跨團組:與校外或北京以外地區單位共同出訪的團組";
var ttop = e.offsetTop; //這裏得到指定控件離父容器控件頂部的距離 px
var tleft= e.offsetLeft; //這裏得到指定控件離父容器控件左邊的距離 px
var h = e.clientHeight; //這裏得到指定控件的高度
var w = e.clientWidth; //這裏得到指定控件的寬度
var originalE = e;
//這裏通過 e = e.offsetParent 操作,一直將e變成document對象,既最高級別的容器;
//這裏ttop 和 tleft 就得到了指定控件距離網頁 頂部 和 左部 的距離;
while (e = e.offsetParent){
ttop += e.offsetTop; tleft += e.offsetLeft;
}
cen.style.display = ""; //層顯示
cen.style.top = ttop + h;
cen.style.left= tleft + w - cen.clientWidth; //上面的代碼都是將懸浮層調整到指定控件的正下方
}
//onmouseout 事件觸發的函數
function out(){
cen.style.display = "none";
}
dojo.connect(unieap.byId("GROUP_TYPE"), "onMouseOver", this, over);
dojo.connect(unieap.byId("GROUP_TYPE"), "onMouseOut", this, out);
//onmouseover 事件觸發的函數
function over(e, message){
cen.innerText = "雙跨團組:與校外或北京以外地區單位共同出訪的團組";
var ttop = e.offsetTop; //這裏得到指定控件離父容器控件頂部的距離 px
var tleft= e.offsetLeft; //這裏得到指定控件離父容器控件左邊的距離 px
var h = e.clientHeight; //這裏得到指定控件的高度
var w = e.clientWidth; //這裏得到指定控件的寬度
var originalE = e;
//這裏通過 e = e.offsetParent 操作,一直將e變成document對象,既最高級別的容器;
//這裏ttop 和 tleft 就得到了指定控件距離網頁 頂部 和 左部 的距離;
while (e = e.offsetParent){
ttop += e.offsetTop; tleft += e.offsetLeft;
}
cen.style.display = ""; //層顯示
cen.style.top = ttop + h;
cen.style.left= tleft + w - cen.clientWidth; //上面的代碼都是將懸浮層調整到指定控件的正下方
}
//onmouseout 事件觸發的函數
function out(){
cen.style.display = "none";
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.