What is difference between
document.getElementById(“selAge”)
document.myForms.selAge
When to use which?
The second one is an absolute no-no! It first finds an element with id/name "myForms" and gets its child, with id/name "selAge". The first one finds any element with the id "selAge". Always use the first one ... because, someone, in the future may decide to put "myForms" into a div. Then you're in a fix.