[Javascript] peculiarity of onselectstart/script viewable

BEKIM BACAJ trojani2000 at hotmail.com
Wed Jul 16 13:01:28 CDT 2003




>From: "BEKIM BACAJ" <trojani2000 at hotmail.com>
>Reply-To: "[JavaScript List]" <javascript at LaTech.edu>
>To: javascript at LaTech.edu
>Subject: Re: [Javascript] peculiarity of onselectstart
>Date: Wed, 16 Jul 2003 19:54:57 +0200
>
>Well, you owe me this one!
>
>the onselectstart turned false disables all the content from being 
>selected, no matter what you do after this will not help so wei will filter 
>unwanted items like this:
>
><html>
>    <head>
>      <title> Trojani </title>
>      <script language='JavaScript'>
>      <!--
>
>function filterSelectability(){
>		var inptName=event.srcElement.name;
>//Headache! - suppressing error for "undefined" elements
>	if (typeof(inptName) == "undefined"){return false}
>//making this compare 'true' for all elements named 'field' no matter the 
>number- helpfull enough!
>		var fld=inptName.substring(0,5);
>	if(fld=='field'){return true}
>		    else{return false}
>		}
>        document.onselectstart = filterSelectability;
>      // -->
>      </script>
>    </head>
>    <body>
>
>      <form name='myBogusForm' action='javascript:void(null)'>
>        <center>
>
>          <input name='field1' type='text' value='' size=30 ><br>
>          <input name='field2' type='text' value='' size=30 ><br>
>
>        </center>
>      </form>
>
>    </body>
></html>
>
>Had some hard time with undefined items but it is solved now,
>Cheers!
>
>>From: "David T. Lovering" <dlovering at gazos.com>
>>Reply-To: "[JavaScript List]" <javascript at LaTech.edu>
>>To: "[JavaScript List]" <javascript at LaTech.edu>
>>Subject: [Javascript] peculiarity of onselectstart
>>Date: Sun, 13 Jul 2003 08:32:04 -0700
>>
>>
>>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
>
>_________________________________________________________________
>Add photos to your e-mail with MSN 8. Get 2 months FREE*. 
>http://join.msn.com/?page=features/featuredemail
>
>_______________________________________________
>Javascript mailing list
>Javascript at LaTech.edu
>https://lists.LaTech.edu/mailman/listinfo/javascript

_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*. 
http://join.msn.com/?page=features/featuredemail



More information about the Javascript mailing list