You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
516 B
24 lines
516 B
<public:component>
|
|
<public:attach event="onblur" onevent="itemOnBlur()" />
|
|
|
|
<public:method name="validate">
|
|
|
|
<script language="javascript">
|
|
function validate() {
|
|
if (element.value.length==0) return true;
|
|
var pat = /(^0{0,1}13[0-9]|15[0-9]|18[0-9]{9}$)/;
|
|
var ret = pat.exec(element.value);
|
|
if(!ret) {
|
|
alert("错误的手机号码格式!");
|
|
element.value="";
|
|
element.focus();
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
function itemOnBlur(){
|
|
validate();
|
|
}
|
|
</script>
|
|
</public:component> |