我在javascript中写了一个if条件,问题是,如果条件为true,语句(警告框)正在执行,如果我在警告框中单击OK按钮,整个网页正在重新加载,并且在每个控件中选择的值将返回到旧状态。代码如下。我试过“返回true”,但它没有用。
if(fromvalue==="" || tovalue1==="")
{
alert('Kindly select the origin and destination');
return true;
}
else if(departuredate==="" || returndate==="")
{
alert('Kindly select the departure and return date');
}
else if(infantcountvalue>adultcountvalue)
{
alert("the infant number should be equal to or less than adult");
}
else if(departureday>returnday)
{
alert('Return date should be after the departure date');
}
else if(totalpassenger>9)
{
alert("Maximum 9 passengers are allowed.");
}
else
{
window.open(StrQueryString);
// submitform();
}