I am trying to run some code that will check if the user enters two values from 'depart' and 'arrival' select lists that would make up an invalid journey:
var cdate, ctime, cdepart, carrive, cname;
with(window.document.example)
{
cdate = date;
ctime = time;
cdepart = depart;
carrive = arrive;
cname = name;
}
if(trim(cdepart.value) == 'Uptown' && trim(carrive.value) == 'Downtown')
{
alert('invalid journey');
cdepart.focus();
return false;
}
function trim(str)
{
return str.replace(/^\s+|\s+$/g,'');
}
However when I select the values the alert is not shown? I think My syntax is okay, maybe not?


Sign In
Create Account


Back to top









