console
Date.prototype.Format = function(fmt) { //author: meizz
// 对Date的扩展,将 Date 转化为指定格式的String
// 月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符,
// 年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字)
// 例子:
// (new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423
// (new Date()).Format("yyyy-M-d h:m:s.S") ==> 2006-7-2 8:9:4.18
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;
}
function genHref() {
tel_no = document.getElementById("tel_id");
amount_text = document.getElementById("amount_id");
var shouquan_href = "http://www.xinxindai.com/xplan/accredit.html?loginid=" + tel_no.value + "&userAttr=" + $("input[name='userAttr']:checked").val() + "&amount=" + amount_text.value + "&time=" + new Date().Format("yyyyMMddhhmmss");
return shouquan_href;
// console.log(shouquan_href);
}
function submitt() {
window.open(genHref());
return false;
}
<div class="Whole_layout">
<h2>
生成授权链接
</h2>
<form action="http://www.baidu.com" method="get" onsubmit="return submitt()">
<input type="radio" name="userAttr" value="2" id="userAttr_id" required>
借款客户
<input type="radio" name="userAttr" value="1">
理财客户
<br/>
手机号码:
<input type="text" name="tel" id="tel_id" pattern="^[1][3,4,5,6,7,8][0-9]{9}$"
autocomplete="true" placeholder="金账户ID" required/>
<br/>
授权额度:
<input type="number" name="amount" id="amount_id" min="5000000" max="100000000"
step="1000000" value="10000000" required/>
<input type="submit" value="去授权" />
<br/>
<span style="color:gray;font-size:10px">
※ 授权额度越大越好,使用默认值1000万即可.
</span>
</form>
<p>
<span style="color:gray;font-size:10px">
提示:可以重复授权,但以最后一次授权的额度为准。<br/>
※ 不支持IE8及以下,建议使用谷歌Chrome浏览器。
</span>
</p>
</div>
.Whole_layout {
margin: 0 auto;
width: 400px;
height: 100px;
}