标签:ack nbsp bsp als ctc reg test time check
//非0 并且大于0 可以是小数----demo1
//日期转化成为yyyy-mm-dd ----demo2
//校验手机号是否是正确---------demo3
//demo1 function isInteger(obj) { reg = /^(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*))$/; if (reg.test(obj)) { return false; } else { return true; } }
//demo2 function DateObjectConvertJSDate(obj){ var date = new Date(obj.time); var seperator1 = "-"; var seperator2 = ":"; var year = date.getFullYear(); var month = date.getMonth() + 1; var strDate = date.getDate(); if (month >= 1 && month <= 9) { month = "0" + month; } if (strDate >= 0 && strDate <= 9) { strDate = "0" + strDate; } var currentdate = year + seperator1 + month + seperator1 + strDate; return currentdate; }
//demo3
function checkMobile(str){ var regu =/^[1][3][0-9]{9}$/; if (regu .test(str)) { return true; }else{ return false; } }
标签:ack nbsp bsp als ctc reg test time check
原文地址:http://www.cnblogs.com/w-ym/p/7278203.html