i have this js code on my page:
var mail = 'idEmail';
value(mail);
//function returning the value of an input
function value(input){
  return eval('window.document.Search.'+input).value;
}
I have this error:
TypeError: Cannot read property 'idEmail' of undefined
Why when i change return eval('window.document.Search.'+input).value; by return eval('window.document.forms['Search'].'+input).value; it's work?
document.forms["general"]
or
document.forms[0]
or
document.general 
it's the same
 
     
    