Thread: pop up box
View Single Post
Old 03-10-2008, 04:40 AM   #12 (permalink)
Orc
The Prestige
 
Orc's Avatar
 
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
Orc is on a distinguished road
Default

No, you can detect the mouse, heres some code to get the position:
Code:
function CursorPosition(e) 
{
	if (!e) e = window.event;
	
    var cursor = {x:0, y:0};
	
	if (!e)
	{
		return cursor;
	}
	
    if (e.pageX || e.pageY) {
        cursor.x = e.pageX;
        cursor.y = e.pageY;
    } 
    else {
        cursor.x = e.clientX + 
            (document.documentElement.scrollLeft || 
            document.body.scrollLeft) - 
            document.documentElement.clientLeft;
        cursor.y = e.clientY + 
            (document.documentElement.scrollTop || 
            document.body.scrollTop) - 
            document.documentElement.clientTop;
    }
    return cursor;
}

// Then you could do
function popup(e)
{

   var pos = CursorPosition(e);
   var popElem = document.getElementById('popup');
   popElem.style.display = "block";
   popElem.style.left = pos.x + '32';
   popElem.style.top = pos.y + '32';
}
__________________
VillageIdiot can have my babbies ;d
Orc is offline  
Reply With Quote
The Following User Says Thank You to Orc For This Useful Post:
freenity (03-10-2008)