Problem showing OnMouseOver PopUp at right mouse position.
-
Hi, I need help regarding displaying small popup message when user mouse over the pointer the hyperlink, I have created this with javascript and it is showing the required popup onmouseover and onMouseOut it is hiding the popup using kill() method given below in code snippest but problem is whenever u scroll the page the popup msg will get displayed at the top and not on the hyperlink(onMouseOver).. If anyone is having any idea of setting the mouse pointer to desired location or any alternate solution to show onHover popup using javascript. Plz see code below: //Hover Text for SSN Xoffset= 20 //-10; //-60; // modify these values to ... Yoffset= -25 //-150; //20; // change the popup position. var old,skn,iex=(document.all),yyy=-1000; var ns4=document.layers var ns6=document.getElementById&&!document.all var ie4=document.all if (ns4) skn=document.dek else if (ns6) skn=document.getElementById("dek").style else if (ie4) skn=document.all.dek.style if(ns4)document.captureEvents(Event.MOUSEMOVE); else { skn.visibility="visible" skn.display="none" } document.onmousemove=get_mouse; function popup(msg,bak) { var content="<TABLE WIDTH=250 BORDER=1 BORDERCOLOR=#01244E CELLPADDING=2 CELLSPACING=0 "+ "BGCOLOR="+bak+"><TD ALIGN=left style='padding-left:5px;font-size:8pt;font-family:Arial;color:#01244E'>"+msg+"</TD></TABLE>"; yyy=Yoffset; if(ns4){skn.document.write(content);skn.document.close();skn.visibility="visible"} if(ns6){document.getElementById("dek").innerHTML=content;skn.display=''} if(ie4){document.all("dek").innerHTML=content;skn.display=''} } function get_mouse(e) { var x=(ns4||ns6)?e.pageX:event.x+document.body.scrollLeft; skn.left=x+Xoffset; var y=(ns4||ns6)?e.pageY:event.y+document.body.scrollTop; skn.top=y+yyy; } function kill() { yyy=-1000; if(ns4){skn.visibility="hidden";} else if (ns6||ie4) skn.display="none" }
-
Hi, I need help regarding displaying small popup message when user mouse over the pointer the hyperlink, I have created this with javascript and it is showing the required popup onmouseover and onMouseOut it is hiding the popup using kill() method given below in code snippest but problem is whenever u scroll the page the popup msg will get displayed at the top and not on the hyperlink(onMouseOver).. If anyone is having any idea of setting the mouse pointer to desired location or any alternate solution to show onHover popup using javascript. Plz see code below: //Hover Text for SSN Xoffset= 20 //-10; //-60; // modify these values to ... Yoffset= -25 //-150; //20; // change the popup position. var old,skn,iex=(document.all),yyy=-1000; var ns4=document.layers var ns6=document.getElementById&&!document.all var ie4=document.all if (ns4) skn=document.dek else if (ns6) skn=document.getElementById("dek").style else if (ie4) skn=document.all.dek.style if(ns4)document.captureEvents(Event.MOUSEMOVE); else { skn.visibility="visible" skn.display="none" } document.onmousemove=get_mouse; function popup(msg,bak) { var content="<TABLE WIDTH=250 BORDER=1 BORDERCOLOR=#01244E CELLPADDING=2 CELLSPACING=0 "+ "BGCOLOR="+bak+"><TD ALIGN=left style='padding-left:5px;font-size:8pt;font-family:Arial;color:#01244E'>"+msg+"</TD></TABLE>"; yyy=Yoffset; if(ns4){skn.document.write(content);skn.document.close();skn.visibility="visible"} if(ns6){document.getElementById("dek").innerHTML=content;skn.display=''} if(ie4){document.all("dek").innerHTML=content;skn.display=''} } function get_mouse(e) { var x=(ns4||ns6)?e.pageX:event.x+document.body.scrollLeft; skn.left=x+Xoffset; var y=(ns4||ns6)?e.pageY:event.y+document.body.scrollTop; skn.top=y+yyy; } function kill() { yyy=-1000; if(ns4){skn.visibility="hidden";} else if (ns6||ie4) skn.display="none" }
My first google hit for javascript scroll position gave me this: To save the last scroll positions (horizontal and vertical): var hscroll = (document.all ? document.scrollLeft : window.pageXOffset); var vscroll = (document.all ? document.scrollTop : window.pageYOffset); then when you swap in the new form just scroll to those positions: window.scrollTo(hscroll, vscroll); So, you need to use the values being used in this code, to offset your menu by the scrollbar position.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.