Solved

Disable carriage returns ASP NET Browser

Posted on 2008-10-06
4
399 Views
Last Modified: 2012-05-05
Is there a way to disable carriage returns using javascript (or any other way) so that when the user clicks "return" on his keyboard the web browser doesn't do anything (like reload, etc.)?

Thanks in advance!
0
Comment
Question by:jeremyduj
  • 2
4 Comments
 
LVL 9

Expert Comment

by:CCongdon
ID: 22652754
Generally, there is no way to disable parts of the keyboard (hardware) from within a browser.
However, one trick is that you could put a text area on the screen, and then use CSS to creatively hide it...and then once the pages loads, set the focus to the text area...
Or possibly someone has a MUCH better idea.
0
 
LVL 1

Author Comment

by:jeremyduj
ID: 22653020
well even if using javascript if there is a way to "do nothing" when a carriage return is entered, that would be just as good.
0
 
LVL 23

Accepted Solution

by:
Saqib Khan earned 500 total points
ID: 22653173
yes you can Stop return key.
<script>

 function kk(e) {

   key = e ? e.which : window.event.keyCode;
   if(key==13) {
      return false;
    }

 }


document.onkeypress = kk

</script>
<textarea name="t1" rows=10  cols=10>hh</textarea>
0
 
LVL 1

Author Closing Comment

by:jeremyduj
ID: 31503533
Thanks so much. Works flawlessly.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Where can I ask about my ASP.NET MVC project? 6 36
VB.NET (2008) - Refactoring Question 2 21
Help with preventing downloading a zip file 10 37
VB.NET 2008 - SQL Timeout 9 24
Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question