window.onload=function (){
  let oTxt=document.getElementById('txt1');
  let oBtn=document.getElementById('btn1');

  oBtn.onclick=function (){
	let re=/^[1-9]\d{4,11}$/;

	if(re.test(oTxt.value)){
	  alert('通过');
	}else{
	  alert('不对');
	}
  };
};
<input type="text" id="txt1">
<input type="button" value="校验" id="btn1">