The character constants in javascript files are closely related to the character encoding in the js file. See the following code:
Var strSex = "male ";
In GB2312 encoding, assume that another variable, strAxSex, is the BSTR value read from the ActiveX control, and the original value is also "male". In this case, compare it in javascript: strSex = strAxSex is false, that is, "male "! = "Male ".
However, if the expression strSex = strAxSex is true in VS2005 debugging, view strSex in detail. charCodeAt (0) and strAxSex. charCodeAt (0) is equal, while strSex. charCodeAt (0) and strAxSex. charCodeAt (0) is also NaN.
Pay attention to the vs2005 variable value prompt and you can see strSex = "□□". It turns out that the character constant is not unicode, so strSex is assigned a value different from the unicode Value of "male. Try to save the js file as UTF-8 encoded and run it again. Finally, strSex = strAxSex is true. The program runs the same way as the debugger, and is consistent with the daily logic.