Solved

Disable carriage returns ASP NET Browser

Posted on 2008-10-06
4
414 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
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)…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

739 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