1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
|
<html>
<head>
<title>Test</title>
<script type="text/javascript">
// Browser rausfinden (hier nur Unterscheidung IE - Mozilla)
var IE = document.all?true:false;
// Mozilla-Abschnitt
if (!IE) document.captureEvents(Event.MOUSEMOVE)
document.onmousemove = getMouseXY;
// temporäre Variablen für die Mausposition
var tempX = 0;
var tempY = 0;
// Hauptfunktion zum Auslesen der Koordinaten
function getMouseXY(e)
{
if (IE)
{
tempX = event.clientX + document.body.scrollLeft;
tempY = event.clientY + document.body.scrollTop;
}
else
{
tempX = e.pageX
tempY = e.pageY
}
}
// Mauskoordinaten ins Verhältnis zur Bildposition setzen und auswerten
function clicky(x, y, target)
{
window.open('whatever.php?x='+(x-target.offsetLeft)+'&y='+(y-target.offsetTop),'');
}
</script>
</head>
<body>
<img src="dragon.jpg" width="500" height="100" onmousedown="clicky(tempX, tempY, this)" alt="klick mich">
</body>
</html> |