Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Proper place for menu Callout

Status
Not open for further replies.

IBACFII

Programmer
Sep 2, 2004
76
US
I am trying to have a menu callout after a user mouses over a specific part on my table that is being presented. This Works. However it covers a portion of the table which is fine for one table but when a new set of data is displayed this is no longer the case Here is a copy of my JS


--------------------------------------------------------
// Compiled by Scott Champion
// Sept 2004
function getAnchorPosition(anchorname)
{


var useWindow=false;
var coordinates=new Object();
var x=0,y=0;

var use_gebi=false, use_css=false, use_layers=false;
if (document.getElementById) { use_gebi=true; }
else if (document.all) { use_css=true; }
else if (document.layers) { use_layers=true; }

if (use_gebi && document.all)
{
x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
y=AnchorPosition_getPageOffsetTop(document.all[anchorname]);
}
else if (use_gebi)
{

var o=document.getElementById(anchorname);
x=AnchorPosition_getPageOffsetLeft(o);
y=AnchorPosition_getPageOffsetTop(o);

}
else if (use_css)
{

x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
y=AnchorPosition_getPageOffsetTop(document.all[anchorname]);

}
else if (use_layers)
{
var found=0;
for (var i=0; i<document.anchors.length; i++)
{
if (document.anchors.name==anchorname) { found=1; break; }
}
if (found==0)
{
coordinates.x=0; coordinates.y=0; return coordinates;
}
x=document.anchors.x;
y=document.anchors.y;
}
else
{
coordinates.x=0; coordinates.y=0; return coordinates;
}

coordinates.x=x;
coordinates.y=y;
return coordinates;
}

function AnchorPosition_getPageOffsetLeft(el)
{

var ol=el.offsetLeft;

while ((el=el.offsetParent) != null) { ol += el.offsetLeft; }
return ol;
}

function AnchorPosition_getWindowOffsetLeft (el)
{
return AnchorPosition_getPageOffsetLeft(el)-document.body.scrollLeft;
}

function AnchorPosition_getPageOffsetTop (el)
{
var ot=el.offsetTop;
while((el=el.offsetParent) != null) { ot += el.offsetTop; }
return ot;
}

function AnchorPosition_getWindowOffsetTop (el)
{
return AnchorPosition_getPageOffsetTop(el)-document.body.scrollTop;
}

var mhTop;
var posi;
var initalCaller;
var timer1;
var holder;


function mh_showmenu(caller)
{
var posi;
var initcaller;
posi=getAnchorPosition(caller);
document.all.mh_menu.style.posTop=posi.y;
document.all.mh_menu.style.posLeft=posi.x+150;
document.all.mh_menu.style.visibility="visible";
initalCaller=caller;
holder=1;
return initalCaller;
}

function mh_hidemenu()
{
holder=0;
setTimeout("sc_hidemenu()",1000);
}

function sc_hidemenu()
{
if (holder==0)
{document.all.mh_menu.style.visibility="hidden";}

}

function sc_holdmenu()
{
holder=1;
document.all.mh_menu.style.visibility="visible";
}

function sc_init()
{
holder=0;
sc_hidemenu();
}

function sc_click(caller)
{
var mymessage;
mymessage="";
mymessage=caller + ":" + initalCaller;
__doPostBack("DD",mymessage);
}

Any Ideas on how to make it "next cell" sensitive?
 
No sooner than i worte this i figured it out.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top