标签:点击 set display clock oca 获得 http == split
30秒倒计时
1 var clock = ‘‘;//定时器对象,用于页面30秒倒计时效果 2 var nums = 30; 3 var validateCodeButton; 4 //基于定时器实现30秒倒计时效果 5 function doLoop() { 6 validateCodeButton.disabled = true;//将按钮置为不可点击 7 nums--; 8 if (nums > 0) { 9 validateCodeButton.value = nums + ‘秒后重新获取‘; 10 } else { 11 clearInterval(clock); //清除js定时器 12 validateCodeButton.disabled = false; 13 validateCodeButton.value = ‘重新获取验证码‘; 14 nums = 30; //重置时间 15 }
获取url参数值
1 //获取指定的URL参数值 http://localhost/pages/setmeal_detail.html?id=3&name=jack 2 function getUrlParam(paraName) { 3 var url = document.location.toString(); 4 //alert(url); 5 var arrObj = url.split("?"); 6 if (arrObj.length > 1) { 7 var arrPara = arrObj[1].split("&"); 8 var arr; 9 for (var i = 0; i < arrPara.length; i++) { 10 arr = arrPara[i].split("="); 11 if (arr != null && arr[0] == paraName) { 12 return arr[1]; 13 } 14 } 15 return ""; 16 } 17 else { 18 return ""; 19 } 20 }
获取当前日期,返回字符串
1 //获得当前日期,返回字符串 2 function getToday() { 3 var today = new Date(); 4 var year = today.getFullYear(); 5 var month = today.getMonth() + 1;//0表示1月,1表示2月 6 var day = today.getDate(); 7 return (year + "-" + month + "-" + day); 8 }
获取指定日期后指定天数的日期
1 //获得指定日期后指定天数的日期 2 function getSpecifiedDate(date,days) { 3 date.setDate(date.getDate() + days);//获取指定天之后的日期 4 var year = date.getFullYear(); 5 var month = date.getMonth() + 1; 6 var day = date.getDate(); 7 return (year + "-" + month + "-" + day); 8 }
标签:点击 set display clock oca 获得 http == split
原文地址:https://www.cnblogs.com/lingblog/p/11829434.html