I'm trying to create a script that contains an if/else statement that uses an outside input to change the color of a box in the html file. Currently I am not seeing any changes, so right now I'm checking if the script is even being noticed and ran. I'll admit that I'm not very good at this, so I apologize if these are really simple problems to fix or that they've been fixed before and I missed it when searching for other posts. If it's the latter, could you send me a link.
Placement: Currently the script is inside the a style tag, and both are outside the body. Should I not have it in the style tag? Should I keep it outside of the body? If the issue is placement, where should I place it.
Currently the if/else statement is not in a function. Does it need to be in a function? If so, how should I set it up so the function gets called every time, but does nothing until the if condition is met? if I don't need it to be a function to run this, how else can I set it up so it will run?
Here's the part of the code that I'm working on, Ignore the contents as all I'm looking for is how to get the script to be noticed and ran.
<script= text/javascript>
var StopTimePivatic = [[175]];
if (StopTimePivatic != 0){
#b[[141]]{
style.background-color= silver;
}
}
else{
#b80, #b81, #b82, #b83, #b84, #b85, #b86, #b87, #b88, #b89, #b90 {
style.background-color = Yellow;
style.color = black;
}
#b0, #b1, #b2, #b3, #b4, #b5, #b6, #b7, #b8, #b9,
#b10, #b11, #b12, #b13, #b14, #b15, #b16, #b17, #b18, #b19,
#b20, #b21, #b22, #b23, #b24, #b25, #b26, #b27, #b28, #b29,
#b30, #b31, #b32, #b33, #b34, #b35, #b36, #b37, #b38, #b39,
#b40, #b41, #b42, #b43, #b44, #b45, #b46, #b47, #b48, #b49,
#b50, #b51, #b52, #b53, #b54, #b55, #b56, #b57, #b58, #b59,
#b60, #b61, #b62, #b63, #b64, #b65, #b66, #b67, #b68, #b69,
#b70, #b71, #b72, #b73, #b74, #b75, #b76, #b77, #b78, #b79 {
style.background-color = red;
}
}
</script>
</style>
<body onload="bundle()">
As I said previously, If as similar problem to this has been solved, please let me know where i can find it.