What about drag events? Save the first
point, drag the mouse and save the end-drag point... Voila. Maybe. Haven't tried
that ever, but could work.
BTW. Instead of those while statements you could also use for statement claverly
without a counter like:
for (o=el; o==null; o=o.offsetParent) top+=o.offsetTop;
But for that MAP problems that you have. No idea... Sorry. But I my college did
something simmilar. He had a floorplan of our company and has made an
administration console for connecting phone numbers of each person to the
floorplan. He entered a phone number and clicked on the picture of the
floorplan. He used this client side functionality:
if (document.layers)
{ // Netscape
document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = captureMousePosition;
}
else if (document.all)
{ // Internet Explorer
document.onmousemove = captureMousePosition;
}
else if (document.getElementById)
{ // Netcsape 6
document.onmousemove = captureMousePosition;
}
// Global variables
xMousePos = 0;
yMousePos = 0;
xMousePosMax = 0;
yMousePosMax = 0;
function captureMousePosition(e)
{
if (document.layers)
{
xMousePos = e.pageX;
yMousePos = e.pageY;
xMousePosMax = window.innerWidth+window.pageXOffset;
yMousePosMax = window.innerHeight+window.pageYOffset;
}
else if (document.all)
{
xMousePos = window.event.x+document.body.scrollLeft;
yMousePos = window.event.y+document.body.scrollTop;
xMousePosMax = document.body.clientWidth+document.body.scrollLeft;
yMousePosMax = document.body.clientHeight+document.body.scrollTop;
}
else if (document.getElementById)
{
xMousePos = e.pageX;
yMousePos = e.pageY;
xMousePosMax = window.innerWidth+window.pageXOffset;
yMousePosMax = window.innerHeight+window.pageYOffset;
}
}
function SendCoords()
{
Form1.txtcox.value = xMousePos;
Form1.txtcoy.value = yMousePos;
}
He had two hidden inputs on the form to send coords to server. He could've used
one also. Hope this code helps a little bit.
Why we need this in our company? We heve IP phones and we have a service on the
computer, that shows the person, that's calling you and his position within the
building. Clever? I think so. And also if you click on a certain place you can
dial the person there. The same thing can be made for inventury parts to easily
find something with the code.
As you can see, he didn't actualy used any ISMAP, but just mouse capture. He
could've subtracted the coordinates of the
image from it, but I think the first
thing on the
page was the image so he didn't have to.