0
If one of the parameters is true then do xyz
I'm trying to get some JavaScript to run if one of the conditions is true but haven't found success yet. I've tried the following: var a = navigator.platform; if (a == "Win32" || a == "Linux armv7l" || //and so forth, you get the point...){ document.getElementById("demo").style.display = "block"; } I've also tried the switch and case code but no success. I'm trying to modify css if user has certain navigator platforms. What am I doing wrong and what should I do instead?
2 odpowiedzi
+ 5
Try === for comparing the variable to the string¿
0
可以试试 === ,==会进行类型比较