Commit 2bc9f226 by 朱继来

特殊字符编码

parent ba5f288d
Showing with 54 additions and 2 deletions
......@@ -14,6 +14,58 @@
return true;
});
// 特殊字符编码
function specialCode(chr)
{
switch (chr) {
case '!': return '%21'; break;
case '"': return '%22'; break;
case '#': return '%23'; break;
case '$': return '%24'; break;
case '%': return '%25'; break;
case '&': return '%26'; break;
case '\'': return '%27'; break;
case '(': return '%28'; break;
case ')': return '%29'; break;
case '*': return '%2A'; break;
case '+': return '%2B'; break;
case ',': return '%2C'; break;
case '/': return '%2F'; break;
case ':': return '%3A'; break;
case ';': return '%3B'; break;
case '<': return '%3C'; break;
case '=': return '%3D'; break;
case '>': return '%3E'; break;
case '?': return '%3F'; break;
case '@': return '%40'; break;
case '[': return '%5B'; break;
case ']': return '%5D'; break;
case '\\': return '%5C'; break;
case '|': return '%7C'; break;
default: return ''; break;
}
}
// 查找特殊字符
function specialStr(str)
{
var reg = new RegExp("[!\"#$%&'()*+,/:;<=>?@\\[\\]\\|]");
var len = str.length;
var rs = '';
for (var i = 0; i < len; i++) {
var val = str.substr(i, 1);
if (reg.test(val)) {
rs = rs + specialCode(val);;
} else {
rs = rs + val;
}
}
return rs;
}
$('.searchOrder').click(function(){
var order_type = $('#order_type').data('default'),
order_contain = $('input[name=order_contain]').val(),
......@@ -33,7 +85,7 @@
listUrl += '?order_type=' + order_type;
if (order_contain) {
listUrl += '&order_contain=' + escape(order_contain);
listUrl += '&order_contain=' + specialStr(order_contain);
}
if(time_start){
......@@ -245,7 +297,7 @@
listUrl += '?order_type=' + order_type;
if (order_contain) {
listUrl += '&order_contain=' + order_contain;
listUrl += '&order_contain=' + specialStr(order_contain);
}
if(time_start){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment