星空网 > 软件开发 > Java

特殊字符转义时间格式化获取URL参数

/*特殊字符转义*/function htmlspecialchars (str) {  var str = str.toString().replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, '&quot;');  return str;}/* *时间格式化 *例子:time = new Date().Format("yyyy-MM-dd hh:mm:ss"); */Date.prototype.Format = function (fmt) {   var o = {    "M+": this.getMonth() + 1, //月份     "d+": this.getDate(), //日     "h+": this.getHours(), //小时     "m+": this.getMinutes(), //分     "s+": this.getSeconds(), //秒     "q+": Math.floor((this.getMonth() + 3) / 3), //季度     "S": this.getMilliseconds() //毫秒   };  if (/(y+)/.test(fmt)){    fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));  }   for (var k in o){    if (new RegExp("(" + k + ")").test(fmt)){      fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));    }  }     return fmt;}/* *获取URL参数 */function getQueryString(key){  var reg = new RegExp("(^|&)"+ key +"=([^&]*)(&|$)");  var r = window.location.search.substr(1).match(reg);  if(r!=null){    return unescape(r[2]);  }  return null;}

 




原标题:特殊字符转义时间格式化获取URL参数

关键词:URL

URL
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

Prime day 开始前,一定要做的6件事!:https://www.ikjzd.com/articles/94316
快递乱贴标签,导致卖家FBA货件无法入仓、触发绩效问题!:https://www.ikjzd.com/articles/94320
特朗普作茧自缚!美国数以万计就业岗位将受影响!:https://www.ikjzd.com/articles/94322
华为凌晨发史上最硬核公开信:斗就斗他个天翻地覆!:https://www.ikjzd.com/articles/94325
亮点巨多!亚马逊品牌加速器项目开始了!:https://www.ikjzd.com/articles/94326
eBay中小卖家不容错过的运营干货!:https://www.ikjzd.com/articles/9433
安能物流的2024:变革不能停:https://www.kjdsnews.com/a/1836480.html
深圳中心公园朱顶红花海位置(在哪里+怎么去):https://www.vstour.cn/a/364175.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流