> So which is faster? > > document.forms.myform.elements.field1 > > or > > document.getElementById(field1)
Hi Simon, First of all thanks for breaking the Target thread ;-) I haven't looked at the code of the Rhino javascript engine, but what your friend says makes sense. The browser creates a tree structure out of your HTML (DOM) so a function like getElementById() would have to traverse the tree to find the element. Using the first form you are giving the javascript engine a direct path to the element. There are ways the writers of the javascript engine could have optimized getElementById() using hash tables, etc. In reality most DOM structures aren't huge so traversing a tree shouldn't take that long. Regards, Kepler Gelotte ******************************************************************* List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] *******************************************************************