JSFiddle Work
First of all, you have a typo on the next line
if((newpath == "")||(newpath.substring(0,4)!='http')||(newath.substring(0,4)!='Http'))
Last, if "newath" should be "newpath", and the same area "! =" Should match the logic of oldpath and instead be "==".
To clear the code a bit more, use "===" and "! ==" instead of "==", as this provides a more accurate comparison.
See this link for more information. Use strict mode.
Here is the adjusted code
, camelCase, JS. "IsEmpty" "isEmpty" .
function isEmpty(){
var oldpath = document.forms['pathuploader'].oldpath.value;
var newpath = document.forms['pathuploader'].newpath.value;
var metavalue = !document.forms['pathuploader'].chkmeta.checked;
var postvalue = !document.forms['pathuploader'].chkpost.checked;
if((oldpath === "")||((oldpath.substring(0,4))!=='http')||((oldpath.substring(0,4))==='Http'))
{
alert("Enter a valid old URL");
return false;
}
if((newpath === "")||(newpath.substring(0,4)!=='http')||(newpath.substring(0,4)==='Http')){
alert("Enter a valid new URL");
return false;
}
if((metavalue) && (postvalue)){
alert("Select any category to change");
return false;
}
return true;
}
"Sourabh", BANG (!).
if(( !metavalue ) && ( !postvalue ){
, . , BANG . , , , , ,
var metaValueNotChecked = !document.forms...
var postValueNotChecked = !document.forms...
if(( metaValueNotChecked ) && ( postValueNotChecked ){
BANG , .
, !