I want to populate my div with exceptions and success messages.
So, every exception should be in red text and every success must be in blue text.
I've done
if(FileName1.length == 0 && FileName2.length == 0 && FileName3.length == 0 && FileName4.length == 0)
{
var err1 = document.getElementById("box");
err1.innerHTML = err1.innerHTML + "<br>" + "No files have been selected to upload";
err1.style.color = "Red";
}
else if(FileName1 == FileName3 || FileName1 == FileName4 || FileName2 == FileName3 || FileName2 == FileName4)
{
var err1 = document.getElementById("box");
err1.innerHTML = err1.innerHTML + "<br>" + "Configuration file and Geco script should not be the same as left or right files. Please check your uploads";
err1.style.color = "Red";
}
//else if(FileName1.value)
else
{
var scc1 = document.getElementById("box");
scc1.innerHTML = scc1.innerHTML + "<br>" + "Uploading files, the page might refresh";
scc1.style.color = "Blue";
document.myform.submit();
}
But wen the success message appears off of the red messages are also changed to blue, how do I deal with this? How do I give blue to success and red to exceptions in the same div?
PS : I've used the below method to preserve previous div data
scc1.innerHTML + "<br>" +