1. a. var aField = myForm['aField']; b. var aField = myForm.document.getElementById('aField') what is the difference between the two ?
getElementnById is a DOM method to find an element by its id. Ids have to be sigular so you can not have more than one element on the page with that id. The other references the form object for a name, names can be repeated on a page! IE is bad and allows for name to be seached by getElementById, but no other browsers allow that. So do not do it! Just a warning!
var myElem = document.forms["name or index number"].elements["name or index number"] is the full way to reference an element with the form object array and element array.
2. Does JS string have same function as aString.trim() in java ? No, but you can add this to your funcitons and it adds the functionality to the string object:
3. Where can I find some mature JS utility package, just like jar component in Java ? Guess you are asking for a library? Look for prototype.js (Google should be first result)