Solved

Disable carriage returns ASP NET Browser

Posted on 2008-10-06
4
382 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:
adilkhan 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 your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

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…
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now