急!!求救字符串对比问题
<script language="javascript">
function macAddress(){
//var macAddress ="";
if(new Boolean(network.ethernets[0])){
if(new Boolean(network.ethernets[0].MACAddress)) {
var macAddress = network.ethernets[0].MACAddress.replace(/-/g, ""); //获取机顶盒mac地址
var a="E8EA680302F3";//可访问的mac地址
if(macAddress==a){
window.location.href="http://10.43.38.12/xnw,0,sy.page";
}
else{
window.location.href="http://10.43.38.12/Verification.jsp";
}
}
}
}
</script>
我弹出提示框macAddress的值就E8EA680302F3为什么就是不进if直接走else呢,电脑上没法跟,因为电脑没有mac地址,求高手解答
------解决方案--------------------var macAddress 难道不是字符串类型?
------解决方案--------------------var macAddress = network.ethernets[0].MACAddress.replace(/(^\s*|\s*$)/g,'');
去掉前后空格