Why does document.forms[0] return something (the first form on the page), but document.getElementById("thediv").forms[0] does not return anything?
On a more complex page, I would expect the be able to narrow down the scope of the browser’s search for form elements by specifying an ID.
formsis a property ofdocument.document.getElementByIdis a function that returns an HTMLElement object. This does not have a property called forms. Look at jQuery if you’d like more logical javascript.