I am attemting to modify an existing website whose maintenance I've inherited. I'm in the process of adding an "Alert" message to provide a way of warning our system users of any issues that may effect the turn-around time of their sample measurements.
I've used Javascript to call a .txt file and display its contents in a paragraph formatted with a red background behind bold white font (like a weather alert on the Weather Channel). It works great. Only problem is, I do not want to display ANYTHING if there is no text to display, so I need to "CONDITIONALLY" display the red paragraph ONLY if there is something to display. I have the following two lines of code that display the message, but I cannot figure out how to make it conditional.
In the rednotice.txt file, I have a single line of code that anyone in our department will be ble to access and edit whenever necessary, eliminating the need for everyone to learn HTML. An example of that txt file is below
document.write('Please be advised that the CMP LIMS measurement system is temporarily unavailable. We will provide further updates when we feel like it.')
I want to look at that file, and if the string inside the parenthesis is empty, just don't even display the paragraph. Otherwise, I'd end up with a big red bar that says "Attention" when there is nothing else to say.
Bookmarks