LAN MIND wrote on 24 jan 2008 in comp.lang.javascript:
> if (xmlhttp) {
> var url = "/jsapi/";
> var filters = ['location_id', 'time_id'];
> for (var i=0; i<filters.length; i++) {
> url += gid(filters[i]).value + '/';
> }
>
> I see the length property a lot and I'm confused about how it works.
> Here I believe it says: loop through: var i is equal to 0, if i is
> less than filters.length then i plus 1.
No, with arrays, it returns the highest member number plus one.
var filters = ['location_id', 'time_id'];
alert(filters.length); // 2
this is the same as:
filters = new Array();
filters[0] = 'location_id';
filters[1] = 'time_id';
alert(filters.length); // 2
Read the specs and all shall be revealed.
> Does the loop count the number of characters in location and based
> upon the value (number) of characters assign a certain url?
You better read the specs.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
|