Jag undrar om det går att få reda på muspekarens position relativt till webläsaren, INTE skärmen. Jag skulle nämligen vilja placera en div precis där muspekaren är, och har man då scrollat ner på sidan så stämmer det inte! Hej...tagen från tomsves sida(tror jag..länge sen jag tog det här och gjorde det):Muspekarens position
/DaPeSv: Muspekarens position
<body onMousemove="skriv()">
<script type="text/javascript">
function browsercheck () {
var info=navigator.userAgent.toLowerCase();
var version=navigator.appVersion;
this.ver = parseInt(version);
this.fullver = parseFloat(version);
this.n = ((info.indexOf('mozilla')!=-1) &&(info.indexOf('compatible') == -1));
this.n4 = (this.n && (this.ver == 4));
this.n4up = (this.n && (this.ver >= 4));
this.n5 = (this.n && (this.ver == 5));
this.n5up = (this.n && (this.ver >= 5));
this.n6 = (this.n && (this.ver == 5));
this.ie = (info.indexOf("msie") != -1);
this.ie4 = (this.ie && (this.ver == 4) && (info.indexOf("msie 5.0")==-1) );
this.ie4up = (this.ie && (this.ver >= 4));
this.ie5 = (this.ie && (this.ver == 4) && (info.indexOf("msie 5.0")!=-1) );
this.ie5up = (this.ie && !this.ie3 && !this.ie4);
}
br = new browsercheck();
function mouse_x(){
if (br.ie4up){
return event.x;
} else {
return m_x;
}
}
function mouse_y(){
if (br.ie4up){
return event.y;
} else {
return m_y;
}
}
function skriv()
{
document.getElementById("gg").innerHTML = " X: " + mouse_x() + " y: " + mouse_y()
}
</script>
<span id="gg"></span>