Common function, practice practiced hand.
<!DOCTYPE HTML Public "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/TR/xhtml1/DTD/ Xhtml1-transitional.dtd "><HTMLxmlns= "http://www.w3.org/1999/xhtml"><Head><styletype= "Text/css">#amplify{width:145px;Height:40px;text-align:Center;font-size:18px;Color:Orange;Background-color:#ffff99;}</style></Head><Body><DivID= "Amplify"></Div><inputtype= "text"ID= "Mobilenumber"maxlength= "One"onkeyup= "Show ()"/><Scripttype= "Text/javascript">functionShow () {vartmp=document.getElementById ("Mobilenumber"). Value,length=Tmp.length,output=tmp; if(Length>3&&length<=7) {Output=Tmp.replace (/(^\d{3})/,"$1-"); } Else if(Length>7) {Output=Tmp.replace (/(^\d{3}) (\d{4})/,"$1-$2-"); } document.getElementById ("Amplify"). InnerHTML=output;}</Script></Body></HTML>
[Daily practice] zoom in when you enter your phone number