function transUrlParaCode(para){
var s = para;
if (para != null){
s = para.replaceAll("%","%25"); s = s.replaceAll(" ","%20"); s = s.replaceAll("/","%2F"); s = s.replaceAll("#","%23");
s = s.replaceAll("\\+","%2B");
s = s.replaceAll("\\?","%3F");
s = s.replaceAll("&","%26");
s = s.replaceAll("\\=","%3D");
}
return s;
}
jquery对查询到的数据中的非法字符进行转义,然后使用转义后的字符当作id使用。防止id中有些符号导致不能作为id使用。
//jquery 中对特殊字符转义
function jqTrans(str){
if(str.length>0&&str.trim()!=""){
str=str.replaceAll(" ","");
str=str.replaceAll("#","");
str=str.replaceAll("\\$","");
str=str.replaceAll("=","");
str=str.replaceAll("&","");
str=str.replaceAll("@","");
}
return str;
}