function CheckFileName() {
var fileName = document.getElementById("fname_Subject_Front").value
if (fileName == "") {
alert("Browse to upload a valid File with jpg extension");
return false;
}
else if (fileName.split(".")[1].toUpperCase() == "JPG")
return true;
else {
alert("File with " + fileName.split(".")[1] + " is invalid. Upload a validfile with jpg extensions");
return false;
}
return true;
}
I have multiple id's that I have to check for the jpg extension and I am stuck on how to do this.
I tried getelementsbyname but it returns a .split error
do I have to just write a bunch of "if" statements or is there an easier way?

New Topic/Question
Reply



MultiQuote




|