用js怎么把&字符换成"&amp:"

2019-06-03 18:03:21刘景俊
var re = /&/g;
var str = "http://www.163.com?id=333&r=999&o=000";

str.replace(re,"&");