|
|
|
5X2 Great Reasons to Go For Online Dating
In this life, isn't everything about attitude towards things?
And here comes your attitude: simply say "yes" to online dating! Obviously you cannot meet people from nowhere, you have to start from a certain spot. I guess you've already done some...
Dating Advice For Those Just Getting Back On The Dating Wagon!
Dating is a daunting prospect, especially for those who’ve been off the circuit for a while. Here’s a little dating advice to help you back on the dating wagon. 1.Remember this is a date for your partner also. They are also going to be nervous...
Dating Red Flag #3: When Good Sex is Bad
Many people have trouble believing that having wonderful sex on the first date can be a dating problem. We've all experienced instant attraction to another person. Or, we believe that what we feel is love at first sight. As a result, some of us...
Men, Are You Too Ugly? Too Short? Here's How To Turn Your Dating Flaws Into Strengths
Are you a guy with a high-pitched voice? Of maybe you've got a face only a mother could love? Well, whatever it is, if you're worried and upset about your physical flaws, which prevent you from attracting women, then I've got some good news for...
Online Dating In Other Countries
$250.00 a year will buy you membership in a matchmaking online dating service. In America, the oldest online dating services have been online since 1997 and include a basic online dating profile, which asks questions with regards to job, likes and...
|
|
| |
|
|
|
|
|
|
Validating Numerical Input with JavaScript
What? Make a mistake entering data? Who me? NO WAY! Right…
Every form of data input by a user should be validated in some form or fashion. If you get
clean data in, you won’t get garbage out. This tutorial is going to explain how to validate
numerical data entered into a form using JavaScript.
First, let us begin with the code to insert the JavaScript into your HTML document.
Place these lines between the and tags.
This line tells the web browser to expect some JavaScript code and signal the beginning of
the script:
So now the format should look something like this:
My Title
Now on to validating the numerical input.
First we will create a function with one arument:
function validate(mydata){
These lines will test for a blank enty then prompt the user for input:
if (mydata == ""){ alert("Please enter a number.") }
Next we will create a for loop which will look at each character in the data until it
reaches the end:
for(var i=0;i < mydata.length;i++){
Now create a variable and assign the
counter variable value to it:
var mydigit = mydata.charAt(i)
To screen out symbols, punctuation, and letters, place an if statement in the loop:
if(mydigit < "0" || mydigit > "9"){
The || in the if statement scans for both conditions.
The next line will alert the user to any mistakes he/she has made:
alert(mydigit + " is not a number.")
Here is the complete code including HTML: ============================================= Numerical Validation
| | |
|
| | |