过滤script标签
var filterScript = function(str){
var reg=new RegExp("<.*?script[^>]*?>.*?(<\/.*?script.*?>)*","ig");
if(reg.test(str)){
return str.replace(/<.*?script[^>]*?>.*?(<\/.*?script.*?>)*/ig,‘‘);
}
return str;};
获取URL中的参数
GetQueryString = function (name){
var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if(r!=null)return decodeURI(r[2]); return null;};
邮箱验证
checkSubmitEmail = function(email) {
if (email == "") {
web.utility.showBasicPrompt({
content:‘邮箱不能为空!‘,
style:‘alert-error‘
});
$("#email").focus();
return false;
}
var reg =/^[a-zA-Z0-9]{1,18}@[a-zA-Z0-9]{1,4}\.[a-zA-Z0-9]{1,4}$/;
if ((!reg.test(email))||email.length>25) {
web.utility.showBasicPrompt({
content:‘邮箱格式不正确!‘,
style:‘alert-error‘
});
$("#email").focus();
return false;
}
return true; };