0

JAVA SCRIPT CODE

function NumbrOnly()
    {
    if(event.KeyCode==45 || event.KeyCode==46 || event.KeyCode==48 || event.KeyCode==49 || event.KeyCode==50 || event.KeyCode==51 || event.KeyCode==52 || event.KeyCode==53 || event.KeyCode==54 || event.KeyCode==55 || event.KeyCode==56 || event.KeyCode==57)
    {
    event.retunValue=false;
    }

<asp:TextBox ID="TextBox3" onkeypress="NumberOnly('TextBox3')" runat="server"></asp:TextBox>

WHAT IAM MISSIGN AND WHEN I WRITE event. then after 'dot' it doesnt show KeyCode Property PLZZZZZ HELP

4
Contributors
6
Replies
7
Views
7 Years
Discussion Span
Last Post by __avd
0

Explain what you need first.
Are you intending to limit the input to your textbox to only accept specific numbers?
Should probably use validators to solve the issue.
Good luck

0

explain what you need first.
Are you intending to limit the input to your textbox to only accept specific numbers?
Should probably use validators to solve the issue.
Good luck

i have textbox of asp.net server side control now i just want to do with java script only that user should be able to enter the numbers from 0-9,allow the user to work with delte,back space, and arrow keys i have used ajax it works fine i have used validation control of asp.net but i want to do with java script only plzzzzzz helppppppppp

0
<script type="text/javascript">
  function NumberOnly(){
          var t=window.event.keyCode;

          if(t>=48 & t<=57)
               return;
          window.event.keyCode=0; 
  } 
</script>
.....
<asp:TextBox ID="TextBox3" onkeypress="NumberOnly()" runat="server"></asp:TextBox>
0

it works fine

<script type="text/javascript">
  function NumberOnly(){
          var t=window.event.keyCode;

          if(t>=48 & t<=57)
               return;
          window.event.keyCode=0; 
  } 
</script>
.....
<asp:TextBox ID="TextBox3" onkeypress="NumberOnly()" runat="server"></asp:TextBox>
0

Please mark this thread as solved if you have found an answer to your question and good luck!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.