如url:
http://localhost:10001/bindlist.html?eui=3.0.1.2.0.0.0.1&clientEUI=6.0.1.1.0.0.0.5
需求:
获取eui和clientEUI的值
方法:
var url = location.search; //获取url中"?“符后的字串
if (url.indexOf(”?") != -1) {
var str = url.substr(1);
strs = str.split("&");
clientEUI = decodeURIComponent(strs[1].split("=")[1].replace(“clientEUI=”,""));
eui = decodeURIComponent(strs[0].split("=")[1].replace(“eui=”,""));
$("#clientEUI").attr(“value”,clientEUI);
$("#eui").attr(“value”,eui);
}
效果如图: