if (str[r + 3]==true ) { $("#form1").append("<div class=\"clickme\" width:10px height:10px style=\" z-index: 10; position: absolute; top:" + str[r + 2] + "px; left:" + str[r + 1] + "px;\"><img id=\"" + str[r] + "\" width:10px height:10px src=\"gantanhao.gif\"/></div>");
}
else {
alert(str[r + 3].toString());
}
求教,str[r+3]的值是true,为什么str[r + 3]==true却是false?该怎样解决?
}
else {
alert(str[r + 3].toString());
}
求教,str[r+3]的值是true,为什么str[r + 3]==true却是false?该怎样解决?
试试
alert(s1 == true);
楼主的问题本身我不理解意思
但是你的提问我可以告诉你 不会
alert(str[0]==true);当然输出是false了。改成:alert(Boolean(str[0])==true);就没问题了,或者你让str[]是Boolean数组也可以