Solved

Disable carriage returns ASP NET Browser

Posted on 2008-10-06
4
421 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

How To Install Bash on Windows 10

Windows’ budding partnership with Canonical has certainly led to some great improvements. One of them being the ability to use Bash on your Windows machine without third party applications! This might be one of the greatest things a cloud engineer in a Windows environment can do!

Question has a verified solution.

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

623 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