Javascript also supports RegExp (regular expressions). I would suggest using Expresso's phone number regexp examples as a base. They have thought about lots of things like area codes in brackets, spaces or dashes between groups of digits, etc. You will need to think about what you want to support:
your local conventions / rules for numbers
domestic area codes
international numbers and dialling prefix
and so on.
It's not as simple as some people think.
Peter
[edit] Here's a simple example of using a Javascript regexp
var pattern = /^\(\d{3}\)\s*\d{3}(?:-|\s*)\d{4}$/
if (pattern.test(string)) {
}
[/edit]