If one of the parameters is true then do xyz | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
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?

12th Apr 2017, 9:46 PM
Max
Max - avatar
2 Respostas
+ 5
Try === for comparing the variable to the stringĀæ
12th Apr 2017, 10:42 PM
Rrestoring faith
Rrestoring faith - avatar
0
åÆ仄čƕčƕ === ,==会čæ›č”Œē±»åž‹ęÆ”č¾ƒ
13th Apr 2017, 3:37 AM
sheng chen
sheng chen - avatar