Re: Disablign the ctrl+click functionality on TDs in Firefox

"John M. Hann" <[email protected]>
Newsgroups gmane.comp.web.dom.wdf
Message-ID <[email protected]>
Great idea, David.  I added a bit more robustness (to prevent script errors), targetting of TD tags, and some example code.  This worked under FF 1.0.7.  Hope this works for you, Seb.

<html>
<title>test title</title>
<body>
<table>
<tr>
<td id="foo">foo</td>
<td>bar</td>
<td onclick="">click</td>
</tr>
</table>
<script language="Javascript">
function stopClickBorder (event) {
  if (event && event.target && (event.target.tagName == 'TD') && event.preventDefault && event.ctrlKey) {
    event.preventDefault(); 
  }
}
document.onmousedown = stopClickBorder;
document.getElementById('foo').onmousedown = stopClickBorder;
</script>
</body>
</html>
 
--- In [email protected], David JH <david.hamilton@b...> wrote:
>
> > >
> > > Ctrl + click on a TD in firefox and it selects it, adding a border
> > around it
> > > to show you.
> > > 
> > > How can I disable this behaviour, or override the styles to hide that
> > > border?
> > > 
> > > cheers
> 
> One thing you can do is add an event handler to the "mousedown" event that
> calls event.preventDefault().  In it's simplest incarnation:
> 
> <td onmousedown="if(event.preventDefault)event.preventDefault()"> ... </td>
> 
> If you don't want to apply it manually to each cell, you could do the same thing
> for the document object (this will have other side effects that you probably
> don't want, however  -  it will depend somewhat on the context of the problem).
>



[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Get fast access to your favorite Yahoo! Groups. Make Yahoo! your home page
http://us.click.yahoo.com/dpRU5A/wUILAA/yQLSAA/9rHolB/TM
--------------------------------------------------------------------~-> 

Unsubscribe
[email protected]

List info
http://www.quirksmode.org/dom/list.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/wdf-dom/

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.