This is a simple page that has a form with an input box, and submit button. the form action calls the current page, formats the number (if it is a number) and displays it above the textbox if it is a 10 digit number it displays "(123)456-7890" if it is a 7 digit number it displays "123-4567"
<%
function phoneformat(phonenumber)
if isnumeric(phonenumber) then
if len(trim(phonenumber)) = 10 then phoneformat = "(" & mid(phonenumber,1,3) & "

" & mid(phonenumber,4,3) & "-" & mid(phonenumber,7,4)
else
if len(trim(phonenumber)) = 7 then
phoneformat = mid(phonenumber,1,3) & "-" & mid(phonenumber,4,4)
end if
end if
end if
end function
if request.form("submit"

= "submit" then
response.write(phoneformat(request.form("unformnum"

))
end if
%>
<html>
<body>
<form name = "phonenumber" method = "post" action = "phone.asp">
<input type = "textbox" name = "unformnum">
<input type = "submit" name = "submit" value = "submit">
</form>
</body>
</html>