.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Interview Question >> JavaScript/VBScript >> Post New Question Subscribe to Interview Questions

How do we validate numeric values in javascript?

Posted By :nishithraj     Posted Date :March 26, 2010    Points :10   Category :JavaScript/VBScript 
Using evt.which or event.keyCode

the value will be numeric if it is between 47 and 58

You can also find related Interview Question to How do we validate numeric values in javascript?  below: 

How to validate a Email-address, in Form using JavaScript?

  
We can validate it through the reg expressions. For example we can declare all the reg expressions of the email in a variable as follows.

var reg = /^([A-Za-z0-9_-.])+@([A-Za-z0-9_-.])+.([A-Za-z]{2,4})$/; We need to compare the actual value with this expression for the validation. (More...)

How to validate the listbox for the duplicate values from textbox.

  
It can be done like below-

on the button click event of your add button you can check, if the already entered value and the textbox values are same or not. if both are same, don't allow it else write the new value like below-

foreach(listItem item in ListBox.Items)
{
if(Item.Text != txtbox1.Text)
{
lb.Items.Add(txtbox.Text);
}
else
{
//add the new value;
} (More...)

How do I convert a numeric type to a string?

  
Call Sytem.Object.ToString(). For example, if the variable count is an integer, write the following:
string text = count.ToString(); (More...)

Which is the code for conversion of varchar to numeric?

  
Convert(numeric(10,0),[ varchar fieldname]) (More...)

Name the DatTypes of JavaScript?

  
1)Integer
2)String
3)Boolean
4)Null (More...)

Can you control concatenation of string values with null values?

  
Concatenation of string values with null values results either null value or string value.
We can control that by setting CONCAT_NULL_YIELDS_NULL on or off.
When it is set to ON, the concatenation will result null and when it is set to OFF, it will result the string.
Setting it ON,
SET CONCAT_NULL_YIELDS_NULL on;
print 'testing' + NULL; --results NULL and prints nothing

Setting it OFF,

SET CONCAT_NULL_YIELDS_NULL off;
print 'testing' + NULL; -- results testing and prints the same (More...)

Whether Javascript is a OOP's based language?

  
No. It doesn't support all the concepts of OOPS. It supports partially. (More...)

Whether VBscript or Javascript which is better?

  
Javascript. Since it is platform independent. (More...)

How do you Implement Timer Control in Javascript?

  
set Timedout("alert('5 seconds')",5000); Here the argument 5000 shows the millisecond value. (More...)

How do you declare 2 dimensional array in Javascript?

  
myarray[0][0]="Compaq 486"
myarray[0][1]="Compaq 586"
myarray[0][2]="Compaq 686"
myarray[1][0]="Dell 486"
myarray[1][1]="Dell 586"
myarray[1][2]="Dell 686"
myarray[2][0]="IBM 486"
myarray[2][1]="IBM 586"
myarray[2][2]="IBM 686" (More...)

Quick Links For Interview Questions Categories:
ASP.Net Windows Application   .NET Framework   C#   VB.Net   ADO.Net  
Sql Server   SharePoint   Silverlight   OOPs   JQuery   JavaScript/VBScript
Biztalk Patten/Practices .IIS WCF WPF WWF
Networking Aptitude Others   All      

Find questions, FAQ's and their answers related to .NET, C#, Vb.Net, Sql Server and many more.

 
Now you can find lots of .NET, C#, Vb.Net, SQL Server,Windows, ASP.Net related Questions and their Answers here at www.dotnetspark.com. Our aim is to help you pass your certification Exams (MCP, MCSD, MCAD etc.,) with flying scores and get good name in your company.

So, Start looking our Interview Question section daily and improve your .NET Skills. You can also help others by posting Interview Questions and their Answers in this section.


Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend