不用转,提交时加个编码即可,你获取str的时候给它编码一下就行了
var str=document.getElementById("ID").value;
str = encodeURIComponent(str);
就上面这两句,你的replace啊什么的全都不用要,这个encodeURIComponent自会把所有特殊字符转义
不用转,提交时加个编码即可,你获取str的时候给它编码一下就行了
var str=document.getElementById("ID").value;
str = encodeURIComponent(str);
就上面这两句,你的replace啊什么的全都不用要,这个encodeURIComponent自会把所有特殊字符转义