Closed Thread Icon

Preserved Topic: how with the dom? (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=18100" title="Pages that link to Preserved Topic: how with the  dom? (Page 1 of 1)" rel="nofollow" >Preserved Topic: how with the  dom? <span class="small">(Page 1 of 1)</span>\

 
bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 06-22-2001 07:13

I'm trying to capture the mouse x and y positions in NN6 with any scroll offsets


I have this for NN4+ x coord e.pageX+window.pageXOffset
I have this for IE 5+ x coord event.x+document.body.scrollLeft

anyone know the dom way to get this value?


Walking the Earth like Kane

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 06-22-2001 09:11

Take a look at this example that I made for Bugimus: http://www.max.co.yu/ozone/mozilla-drag.html

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 06-22-2001 16:47

hmm. I thought I saw that page work before but I just tried it with my new version of NN 6 and it's not working.

Wierd thing is it's not erroring either.


Walking the Earth like Kane

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 06-22-2001 18:01

I'll be able to get an answer up for this later when I get home, I think...

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 06-22-2001 18:33

Bitdamaged, try changing:

if (e.button != 0) return true;

to

if (e.button != 1) return true;

I noticed that Mozilla people changed something regarding button numbering after their initial 0.6 release...

BTW That page works fine for me in Mozilla 0.9.1 ...

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 06-22-2001 18:51

Max that did it

...sorta

The button now works (what a freakin pain now you have to detect mozilla versions for button numbers???)

This is what I get on the about page Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; m18) Gecko/20010131 Netscape6/6.01

however it doesn't get the offset. Notice if you drag the box down and then shrink the window so the box isn't visible and you have to scroll down to the box it no longer works

I'll go grab the mozilla release and try that.


Walking the Earth like Kane

[This message has been edited by bitdamaged (edited 06-22-2001).]

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 06-22-2001 19:06

When I created that example I used button = 1 (I was using Mozilla 0.6 then). Everything was fine, but after some time (if I remember correctly, I was using Mozilla 0.8 then), I noticed that it didn't work anymore (button numbering started from 0 from that version), so I've changed that example page. Anyway, your version of Shitscape is very old. I believe that now they have version 6.1 (it's based on Mozilla 0.9.1), so I think that checking for different version of Shitscape would be unnecessary, because most people will always use the latest version.

Oh, and as far as that problem with scrolling is concerned, change:

var x = e.clientX;
var y = e.clientY;

to

var x = e.clientX+window.pageXOffset;
var y = e.clientY+window.pageYOffset;



[This message has been edited by mr.maX (edited 06-22-2001).]

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 06-22-2001 20:44

OK, this is the function I use for mouse movement when I'm not worrying about NN 4.x support. I'm sure you know how to combine that with this function if you want to.

var DOM = document.getElementById?true:false;
var IE = document.all?true:false;

// put this in an onload function:
if (IE)
{
&nbsp;&nbsp;&nbsp;&nbsp;document.onmousemove = GetMousePos;
&nbsp;&nbsp;&nbsp;&nbsp;document.onmousedown = MouseDown;
}
else if (DOM)
{
&nbsp;&nbsp;&nbsp;&nbsp;document.body.onmousemove = GetMousePos;
&nbsp;&nbsp;&nbsp;&nbsp;document.body.onmousedown = MouseDown;
}

var mx=0, my=0;
function GetMousePos(e)
{
&nbsp;&nbsp;&nbsp;&nbsp;if (IE)
&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (event.button == 3) return true;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mx = event.x + document.body.scrollLeft;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;my = event.y + document.body.scrollTop;
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;else if (DOM)
&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (e.button == 3) return;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mx = e.clientX + pageXOffset;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;my = e.clientY + pageYOffset;
&nbsp;&nbsp;&nbsp;&nbsp;}
}

That works for me on IE and Mozilla.

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 06-22-2001 20:46

Er, ignore the assignments to onmousedown in that code.

« BackwardsOnwards »

Show Forum Drop Down Menu