?
Solved

How to envoke the BackSpace event in Javascript

Posted on 2006-07-05
7
Medium Priority
?
514 Views
Last Modified: 2012-08-14
I have a texbox in my asp page. When the user enter some non-numerical value, it will pop up a message,

"Please Enter only Numbers".  Along with this message, I want to delete the non-numerical character entered by the user. In VB I use Sendkeys + {BACKSPACE}. When I give this command, it sends a backspace .

I want a similar option in Javascript. Any idea???
0
Comment
Question by:CWS (haripriya)
[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
  • 4
  • 2
7 Comments
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 2000 total points
ID: 17041594
No. However you can cancel the event or chop the field to value.length-1

Michel
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 17041613
0
 
LVL 7

Expert Comment

by:ljubiccica
ID: 17041714
Hey!

Well you probably have some function that checks the data given and then shout out some alert message???

In this case you can do something like this:

<script language="javascript">
function alert(){
alert('Enter the real stuff');
resetData();
}

function resetData(){
document.myinput.reset();
}
</script>

where the input you want clear must have the name you specified in document.myinput.reset();
(in this case you would have <input name="myinput">

Hope this is what you needed...

Ljubiccica
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 17041768
@Ljubiccica - welcome to EE.
A few things:

There is no reset on field level...
Also you cannot access a field via document.fieldName
Please do not confuse people...
0
 
LVL 7

Expert Comment

by:ljubiccica
ID: 17041861
OK, i'm sorry...

i should have asked first where does cyberwebservice want to reset things...

i thought he wants to reset <input type="checkbox"> thing...

Sorry once again

Ljubiccica
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 17042235
That is ok, however the code you proposed is not doing anything on any browsers regardless of what he wanted...
0
 
LVL 16

Author Comment

by:CWS (haripriya)
ID: 17200359
Sorry guys, no time for me to test your suggestions. I was tied up with other projects which doesnot use Javascript. I need some more time.

I just want to add coments to avoid this questions to get abondend.

I will check and get back to you soon.
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

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