标签:img escape reg eth 技术 min seconds date 获取
一:
//系统当前时间
function show(){
var mydate = new Date();
var str = "" + mydate.getFullYear() + "年";
str += (mydate.getMonth()+1) + "月";
str += mydate.getDate() + "日";
str+=mydate.getHours() + "时";
str+=mydate.getMinutes() + "分";
str+=mydate.getSeconds() + "秒";
return str;
}
function show1(){
function p(s) {
return s < 10 ? ‘0‘ + s: s;
}
var myDate = new Date();
//获取当前年
var year=myDate.getFullYear();
//获取当前月
var month=myDate.getMonth()+1;
//获取当前日
var date=myDate.getDate();
var h=myDate.getHours(); //获取当前小时数(0-23)
var m=myDate.getMinutes(); //获取当前分钟数(0-59)
var s=myDate.getSeconds();
var now=year+‘-‘+p(month)+"-"+p(date)+" "+p(h)+‘:‘+p(m)+":"+p(s);
return now;
}
console.log(show1())
console.log(show())
输出结果:
非 原创;
二:
getQueryString:function(name){
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
//console.log(r,‘url‘)
if (r != null && r != undefined) {
return unescape(r[2]);
}else{
return null;
}
},
ps:name 为 键值;
标签:img escape reg eth 技术 min seconds date 获取
原文地址:http://www.cnblogs.com/Pirate630/p/6912302.html