From: MikeJ on 26 Mar 2010 13:36 I have a script that allows users to move "windows" (actually floating tables) about but as they do so text in the background gets highlighted (because the mouse button is down for the dragging) - can I hide or disable this highlighting? Thanks Mike
From: Martin Honnen on 26 Mar 2010 14:22 MikeJ wrote: > I have a script that allows users to move "windows" (actually floating > tables) about but as they do so text in the background gets > highlighted (because the mouse button is down for the dragging) - can > I hide or disable this highlighting? How do you attach the even listener? With the W3C DOM Level 2 Events you should be able to prevent the text selection in an mousedown listener by calling preventDefault() e.g. foo.addEventListener('mousedown' function(evt) { evt.preventDefault(); // ... }, false ); For IE add an onselectstart listener that returns false e.g foo.attachEvent('onselectstart', function() { return false; }); -- Martin Honnen http://msmvps.com/blogs/martin_honnen/
From: MikeJ on 26 Mar 2010 17:06 I better go read some more... I was simply using onMouseDown for the table. I wasn't attaching anything :) I figured there must be a way to prevent it. Thanks On Fri, 26 Mar 2010 19:22:49 +0100, Martin Honnen <mahotrash(a)yahoo.de> wrote: >How do you attach the even listener? With the W3C DOM Level 2 Events you >should be able to prevent the text selection in an mousedown listener by >calling preventDefault() e.g. > foo.addEventListener('mousedown' > function(evt) { > evt.preventDefault(); > // ... > }, > false > ); > >For IE add an onselectstart listener that returns false e.g > > foo.attachEvent('onselectstart', function() { return false; });
From: MikeJ on 27 Mar 2010 22:04 document.getElementbyId("12").addEventListener("mousedown", alert(), false); I did this as a test. Id="12" is set in a table td. It errors saying it expected an object. I have this in script below the table. Thanks On Fri, 26 Mar 2010 19:22:49 +0100, Martin Honnen <mahotrash(a)yahoo.de> wrote: >MikeJ wrote: >> I have a script that allows users to move "windows" (actually floating >> tables) about but as they do so text in the background gets >> highlighted (because the mouse button is down for the dragging) - can >> I hide or disable this highlighting? > >How do you attach the even listener? With the W3C DOM Level 2 Events you >should be able to prevent the text selection in an mousedown listener by >calling preventDefault() e.g. > foo.addEventListener('mousedown' > function(evt) { > evt.preventDefault(); > // ... > }, > false > ); > >For IE add an onselectstart listener that returns false e.g > > foo.attachEvent('onselectstart', function() { return false; });
From: MikeJ on 27 Mar 2010 22:10 sorry - the eror is that 'object doesn't support this property or method'. I tried attaching it to different types of objects and still same. On Fri, 26 Mar 2010 19:22:49 +0100, Martin Honnen <mahotrash(a)yahoo.de> wrote: >MikeJ wrote: >> I have a script that allows users to move "windows" (actually floating >> tables) about but as they do so text in the background gets >> highlighted (because the mouse button is down for the dragging) - can >> I hide or disable this highlighting? > >How do you attach the even listener? With the W3C DOM Level 2 Events you >should be able to prevent the text selection in an mousedown listener by >calling preventDefault() e.g. > foo.addEventListener('mousedown' > function(evt) { > evt.preventDefault(); > // ... > }, > false > ); > >For IE add an onselectstart listener that returns false e.g > > foo.attachEvent('onselectstart', function() { return false; });
|
Next
|
Last
Pages: 1 2 Prev: Code checking with the Narcissus parser Next: Javascript PDF reference manual? |