html转义字符的比较问题
为什么两次比较都是false, " "被转成了什么
<SELECT name= "FILE_SELECT1 ">
<OPTION value= " " selected> blank </OPTION>
</SELECT>
<SCRIPT>
var sss = FILE_SELECT1[0].value;
alert(sss == " ");
alert(sss == " ");
</SCRIPT>
[解决办法]
<SELECT name= "FILE_SELECT1 ">
<OPTION value= " " selected> blank </OPTION>
</SELECT>
是HTML格式,离开IE解释器就没有任何意义了。
如果 要空 直接按照上面的来写就行了,或者
<SELECT name= "FILE_SELECT1 ">
<OPTION value= " " selected> blank </OPTION>
</SELECT>
[解决办法]
其ASCII码为160,示例如下:
<SELECT name= "FILE_SELECT1 ">
<OPTION value= " " selected> blank </OPTION>
</SELECT>
<SCRIPT>
var sss = FILE_SELECT1[0].value;
alert(sss == " ");
alert(sss.charCodeAt());
var xxx= " ";
alert(xxx== " ");
alert(xxx.charCodeAt());
</SCRIPT>