function send(url, elem) {
let value;
let form = document.forms['form'];
if (typeof(elem)==='object') value=elem.value;
else value=document.getElementById(elem).value;
let s_value=form.elements['s'].value;
if(s_value=='szukaj' || s_value=='') {
location.href=url;
return false;
}
else {
form.action=url;
form.submit();
return false;
}
return true;
};
Wywołanie np.
var url = 'http://www.wolakorybutowa.pl'
send(url, 'pole1');