🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.javascript
Article #193

Re: Położenie kursora na stronie

#193
From: Adam Różewicki
Date: Wed, 02 Jan 2002 12:24
47 lines
1893 bytes
Użytkownik "visor" <oqra@kki.net.pl> napisał w wiadomoœci
news:a0ut6p$mha$1@news.tpi.pl...
> Mam pytanie.
>
> Czy da sie z poziomu JavaScript odczytac współrzędne w których znajduje
się
> kursor myszki ?
> Chodzi mi głównie o przeglądarke Internet Explorer.
>
> Pozdrawiam
> Visor

Da sie! Oto przyklad - sciagnalem to zywcem z jednej mojej strony i dlatego
moze wymagac malych przerobek, ale powinno wystarczyc.

Pozdrawiam
ADi

var nn4,ie4,t;
nn4=(document.layers)?true:false;
ie4=(document.all)?true:false;

function init(){
  document.onmousemove = mouseMove;
  if(nn4) document.captureEvents(Event.MOUSEMOVE);
}
window.onload=init;

function mouseMove(e){
  mousePosition(e);
}

function mousePosition(e){
  if(nn4){
    x=e.pageX;
    y=e.pageY;
  }
  if(ie4){
    x=event.x+document.body.scrollLeft;
    y=event.y;
    if(y<1300){
      y=event.y+document.body.scrollTop;
    }
  }
  window.status=("x:"+x+"  y:"+y);
}
Technical Details
Message-ID: <a0utrh$d41$1@flis.man.torun.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!pingwin.icm.edu.pl!warszawa.rmf.pl!newsfeed.tpinternet.pl!news.task.gda.pl!news.man.torun.pl!not-for-mail
References: <a0ut6p$mha$1@news.tpi.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!pingwin.icm.edu.pl!warszawa.rmf.pl!newsfeed.tpinternet.pl!news.task.gda.pl!news.man.torun.pl!not-for-mail
From: Adam Różewicki <adamr@lo.pl>
Newsgroups: pl.comp.lang.javascript
Subject: Re: Położenie kursora na stronie
Date: Wed, 2 Jan 2002 13:24:14 +0100
Organization: TORMAN
Lines: 50
Message-ID: <a0utrh$d41$1@flis.man.torun.pl>
References: <a0ut6p$mha$1@news.tpi.pl>
NNTP-Posting-Host: border.logon.pl
X-Trace: flis.man.torun.pl 1009973937 13441 195.116.217.2 (2 Jan 2002 12:18:57 GMT)
X-Complaints-To: usenet@man.torun.pl
NNTP-Posting-Date: 2 Jan 2002 12:18:57 GMT
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit