title: Javascript seems to have disabled my Ctrl+V function
body: <p>I am trying to left-justify a cursor when I click into a textbox, because the textbox has a mask on it and sometimes a user will paste into the center of the box causing all sorts of issues.</p>
  
  <p>I admit I didn't write this, nor am I fluent in either C#, dot net or Javascript, so I'm having trouble understanding why it's not working.</p>
  
  <p>My script looks like this:</p>
  
  <pre><code>&lt;script type = "text/javascript"&gt;
      //Add this to the textbox: OnFocus="txtEPro_OnFocus()" 
      function txtEPro_OnFocus() {
          var elem = document.getElementById('&lt;%= txtePro.ClientID %&gt;');
          elem.value = "";
          elem.setSelectionRange(0, 0);
  
          var event = event || window.event;
          if (event.button == '0') {
              // it was a right click
              setTimeout(function () {
                  elem.setSelectionRange(0, 0);
              }, 0);
  
          }
          // alert("Hello there"); 
      }
  
  &lt;/script&gt;
  
  &lt;script type = "text/javascript"&gt;
      $(document).mousedown(function () {
          if (event.button == 2 &amp;&amp; event.srcElement.id == '&lt;%= txtePro.ClientID %&gt;') {
              var elem = document.getElementById('&lt;%= txtePro.ClientID %&gt;');
              elem.setSelectionRange(0, 0);
          alert('right click not allowed');
          return false;
          }
          if (event.button == 2 &amp;&amp; event.srcElement.id == '&lt;%= TBAccountNum.ClientID %&gt;') {
              var elem = document.getElementById('&lt;%= TBAccountNum.ClientID %&gt;');
              elem.setSelectionRange(0, 0);
          alert('right click not allowed');
          return false;
          }
          if (event.button == 1 &amp;&amp; event.srcElement.id == '&lt;%= txtePro.ClientID %&gt;') {
              var elem = document.getElementById('&lt;%= txtePro.ClientID %&gt;');
              elem.setSelectionRange(0, 0);
          //alert('left click not allowed');
          return false;
          }
          if (event.button == 1 &amp;&amp; event.srcElement.id == '&lt;%= TBAccountNum.ClientID %&gt;') {
              var elem = document.getElementById('&lt;%= TBAccountNum.ClientID %&gt;');
              elem.setSelectionRange(0, 0);
          //alert('left click not allowed');
          return false;
          }
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>This is supposed to left-justify the cursor, as well as eliminate the ability of the user to right-click to paste data into the field.</p>
  
  <p>Running this locally works fine.  When I upload it to my server, it doesn't paste anything.</p>
  
  <p>Is there something obvious that's missing here?</p>