Solved

How to envoke the BackSpace event in Javascript

Posted on 2006-07-05
7
480 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)
  • 4
  • 2
7 Comments
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 500 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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
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…

705 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

15 Experts available now in Live!

Get 1:1 Help Now