I'm not really skilled with javascript and I want to add text to a div when a variabel is 1 or 0. I'm not sure if a function is necessary. I'm trying it like this:
var alertt = document.getElementById('Alert');
if(:="OUT_MachineActive": == 1) // Value that gives 1 or 0
{
alertt.style.backgroundColor = 'green';
alertt.firstChild.data = "NO ERROR";
}
if(:="OUT_MachineActive": == 0)
{
alertt.style.backgroundColor = 'red';
alertt.firstChild.data = "ERROR!!! Shredder1 is off!";
}
</script>

It's working but the text, I would like to have the text "Shredder1 is off!" on the 2nd line. Like this:
ERROR!!!!
Shredder1 is off!
I already tried something like:
alertt.firstChild.data = "ERROR!!!" + <br /> + "Shredder1 is off!";
But that isn't working.
.innerHTMLinstead of.data. Using innerHTML will correctly interprete the "<br />".