之前做了一个博客跳转页面,用onclick事件响应跳转到编辑页面时,出现乱码,解决办法用encodeURI()进行编码,
用decodeURI() 函数对encodeURI() 函数编码过的 URI 进行解码。
第一个页面:
window.location.href = "editBlog.html?title=" + encodeURI(obj.title) +
"&tag=" + encodeURI(currentTag.id) + "&content=" + encodeURI(obj.content) + "&id=" +encodeURI(obj.id) ;
第二个编辑页面取值:
var search = decodeURI(location.search);