過濾script標籤web
var filterScript =
function(str){
var reg=
new RegExp("<.*?script[^>]*?>.*?(<\/.*?script.*?>)*","ig");
if(reg.test(str)){
return str.replace(/<.*?script[^>]*?>.*?(<\/.*?script.*?>)*/ig,'');
}
return str;};
獲取URL中的參數spa
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;};
郵箱驗證code
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;
};