[Project_owners] getElementsByTagName() problem

Neil neil at parkwaycc.co.uk
Wed Apr 12 10:33:50 EDT 2006


Eric H. Jung wrote:

>  var inputFields = new Array();
>
>  // Check doc
>  var fields = doc.getElementsByTagName("input");
>  for (var i=0; i<fields.length; i++)
>    inputFields.push(fields[i]);
>
In addition to what everyone else said, in JavaScript 1.6 (Gecko 1.8) 
you can use
var inputFields = Array.slice(doc.getElementsByTagName("input"));
Unfortunately due to an oversight you can't loop over frames and call 
Array.concat directly, you have to "slice" each node list into an array 
first.


More information about the Project_owners mailing list