1,手机号的校验
//手机号的判断
function checktel()
{
//手机号不为空,格式校验
var tel = $(".uidbtp").val();
if(tel == null || tel == undefined || tel == "")
{
alert("手机号不能为空");
return false;
}
//手机号格式的判断
if(!/^1d{10}$/.test(tel)){
alert("手机号格式错误!");
return false;
}
}
2,获取url传过来的参数
function getQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
if (r != null)
return unescape(r[2]);
return null;
}
3,验证码重新获取倒计时
function settime() {
if (countdown == 0) {
_generate_code.attr("disabled",false);
$("#btn_send").html("重新获取");
countdown = 60;
return false;
} else {
_generate_code.attr("disabled", true);
$("#btn_send").html("已发送(" + countdown + ")");
countdown--;
}
setTimeout(function() {
settime();
},1000);
}
4,字符串解码
function HTMLDecode(text) {
var temp = document.createElement('div');
temp.innerHTML = text;
var output = temp.innerText || temp.textContent;
temp = null;
return output;
}
5,单选按钮赋初值(jeeplus)
//单选按钮初始化
if($(".staid").val() == "" || $(".staid").val() == undefined || $(".staid").val() == null)
{
$("#statusele div:first").addClass("checked");
$("#haspatent div:first").addClass("checked");
}
<td class="width-15 active">
<label class="pull-right"><font color="red">*</font>上线/下架:</label>
</td>
<td class="width-35" id="statusele">
<form:radiobuttons path="status" items="${fns:getDictList('yy_status')}" itemLabel="label"
itemValue="value" htmlEscape="false" class="i-checks required" />
</td>
6,列表时间显示
,{
field: 'endtime',
title: '结束时间',
sortable: true,
sortName: 'endtime',
formatter:function(value, row , index){
return value.substr(0,10)+"</br>"+value.substr(11,8);
}
}