var url ="http://www.baidu.com/aaa bbb";
alert(encodeURI(url) //该方法会将一些不能用在URI的字符进行编码
上面的空格将被替换成%20
alert(decodeURI(encodeURI(url))); 将会原样输出
alert(encodeURI(url) //该方法会将一些不能用在URI的字符进行编码
上面的空格将被替换成%20
alert(decodeURI(encodeURI(url))); 将会原样输出