var $email_reg = /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
var $int_reg = /^\d+$/;
var $float_reg = /^\d+(\.\d{1,2})?$/;
var $time_reg = /^([0-1]?[0-9]|2[0-3]):[0-5][0-9]$/;
var $date_reg = /^[0-9]{4}\-(0[0-9]|1[0-2])\-([0-2][0-9]|3[0-1])$/;
var $date_time_reg = /^[0-9]{4}\-(0[0-9]|1[0-2])\-([0-2][0-9]|3[0-1]) ([0-1]?[0-9]|2[0-3]):[0-5][0-9]$/;
var $lower_reg = /[a-z]/;
var $upper_reg = /[A-Z]/;
var $inter_reg = /[0-9]/;
$js_date_lang = {
aWeekStr: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
aLongWeekStr:["Sunday", "Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],
aMonStr: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
aLongMonStr: ["January","February","March","April","May","June","July","August","September","October","November","December"]
}
String.prototype.htmlspecialchars = function(){
return this.replace(/\&/g,'&').replace(/\"/g,'"')/*.replace(/\'/g,''')*/.replace(/\</g,'<').replace(/\>/g,'>')
};
String.prototype.unhtmlspecialchars = function(){
return this.replace(/\&\;/g,'&').replace(/\"\;/g,'"').replace(/\'\;/g,'\'').replace(/\<\;/g,'<').replace(/\>\;/g,'>')
};
function UpperFirstLetter(str)
{
return str.replace(/\b\w+\b/g, function(word) {
return word.substring(0,1).toUpperCase( ) +
word.substring(1);
});
}
js 验证函数 和 一些 常用函数
最新推荐文章于 2021-12-19 22:27:01 发布