Variable not accessible when initialized outside function
It really depends on where your JavaScript code is located. The problem is probably caused by the DOM not being loaded when the line var systemStatus = document.getElementById(“system-status”); is executed. You could try calling this in an onload event, or ideally use a DOM ready type event from a JavaScript framework.