function getQueryString(parameter) {
var para = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var p = window.location.search.substr(1).match(para);
if (p != null) return decodeURI(p[2]); return null;
}
var GoodsName = getQueryString("GoodsName");不多逼逼了,直接上代码,之前获取的中文参数一直乱码
后来查到了
JavaScript decodeURI() 函数
不容易
本文提供了一种使用JavaScript decodeURI()函数解决URL中获取的中文参数出现乱码的方法。通过示例代码展示了如何正确地从URL中提取并解码中文参数。
1万+

被折叠的 条评论
为什么被折叠?



