How to check text validations to form data entered by user?

Can any one write a code to do this in javascript?

When do you want the validation to happen? When you click the submit button?
An easy way would be to have a button(type="button") and an onclick event:

<input type="button" value="Click" onclick="validate();" />

Then define a validate function, inside it use javascript to take the values of the fields you want to validate and if successful submit the form.

You will find good tutorials here:
http://www.w3schools.com/default.asp

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.