[JavaScript] peculiarity of onselectstart

David T. Lovering dlovering at gazos.com
Mon Jul 14 10:01:20 CDT 2003


Actually no, I hadn't -- I had presumed that this event handler was
"global", and that the bubbling was implicit in the top-level document.onselectstart
declaration at the beginning of the app window.  Any notions as to the
"correct" style/placement of these mid-stream event blocks that won't impair functionality
above/below the object under consideration?

-- Dave Lovering

Chris Tifer wrote:
> 
> Have you tried cancelling the bubbling of the event? If an event
> fires on an element, it fires all the way up the chain. You need to
> stop that event when fired by the correct element.
> 
> Chris Tifer
> http://emailajoke.com
> 
> ----- Original Message -----
> From: "David T. Lovering" <dlovering at gazos.com>
> To: <javascript at LaTech.edu>
> Sent: Sunday, July 13, 2003 1:30 PM
> Subject: Re: [JavaScript] peculiarity of onselectstart
> 
> >
> > I just noticed in passing a peculiarity of "onselectstart" which is
> somewhat annoying.
> >
> > What I want to be able to do is eliminate drag-selection of multiple
> fields, blank form background, etc. by an
> > inadvertant swipe of the mouse while the select button is depressed, while
> at the same time still permitting
> > drag-selection of the contents of single fields.  Ostensibly this model
> should work:
> >
> > <html>
> >     <head>
> >       <title> bogus </title>
> >       <script language='JavaScript'>
> >       <!--
> >         document.onselectstart = disableSelect;
> >         function disableSelect { return false; }
> >         function enableSelect { return true; }
> >       // -->
> >       </script>
> >     </head>
> >     <body>
> >       <form name='myBogusForm' action='javascript:void(null)'>
> >         <center>
> >           <input name='field1' type='text' value='' size=30
> onselectstart='enableSelect'><br>
> >           <input name='field2' type='text' value='' size=30
> onselectstart='enableSelect'><br>
> >         </center>
> >       </form>
> >     </body>
> >     </html>
> >
> > Sadly, the 'document.onselectstart' declaration appears to take precedence
> over all the fields, irrespective of whether they have localized
> onselectstart declarations of their own.  Yes, I've tried using straight
> 'return true' declarations in lieu of
> > 'enableSelect' function calls.  Still no cigar.
> >
> > Anybody have any ideas?  This one has me stumped.
> >
> > -- Dave Lovering
> > _______________________________________________
> > Javascript mailing list
> > Javascript at LaTech.edu
> > https://lists.LaTech.edu/mailman/listinfo/javascript
> 
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript


More information about the Javascript mailing list