<form class="form-horizontal" name="mobileform" style="padding:10px;" onSubmit="return checkMobile();">
<div class="span12">
<span class="pull-left title-ipone">手机号:</span>
<input class="span10 pull-right" name="mobile" type="number" placeholder="请输入手机号"/>
</div>
<div class="text-center span12 ml0">
<button type="submit" class="btn btn-warning" style="margin-top:20px;">查 询</button>
</div>
</form>
javascript 代码: function checkMobile(){ var sMobile = document.mobileform.mobile.value if(sMobile==''){
alert('请输入手机号');
}else if(!(/^[|][-]\d{,}$/.test(sMobile))){
alert("请输入正确的手机号码");
document.mobileform.mobile.focus();
return false;
}
}