Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: "Christoph M. Becker" Newsgroups: comp.lang.javascript Subject: Re: Problem determining iFrame source url ... Date: Thu, 29 Jan 2015 15:04:46 +0100 Organization: solani.org Lines: 39 Message-ID: References: <290120151339129330%timstreater@greenbee.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Trace: solani.org 1422540278 27897 eJwFwYkBwEAEBMCWCOsph0P/JWQGYmzP1WCKw2n4iMZiu9l3KJE8Nk4giXr2EfVtsYM5s34TnRCi (29 Jan 2015 14:04:38 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Thu, 29 Jan 2015 14:04:38 +0000 (UTC) User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 X-User-ID: eJwFwQkBACAIA8BKvEPjILr+EbxLh2IqkIhkMq4EuY5kSZn1VqPI3NnPcR6Xo1Wqa+oYej4WRhEj In-Reply-To: <290120151339129330%timstreater@greenbee.net> Cancel-Lock: sha1:ba7eASc2A9o0efkI218euj74aZU= X-NNTP-Posting-Host: eJwVyckRwEAIA7CWwmGzlAPM0n8JSR56CUbhhBN0LDbGz/bn0egbUt6lmRJ54t+FQecayNHWegEYyBDj Xref: csiph.com comp.lang.javascript:26749 Tim Streater wrote: > In article , > sean mc wrote: > >> below, it works fine....sort of... : >> -------------------------------------------------------- >> >> -------------------------------------------------------- > > In this function, i is declared (var i = 0), incremented (by the i++), > and then compared with len. > > I can't see why i would ever have a value other than 1 when this > statement: > > if (i >= len) return; // no more changing > > is executed. The same is true of your function. So what is the point of > the variable i or indeed the test to compare with len ?? I guess that i is supposed to be declared outside of ChangeSrc(). However, as the code has a syntax error anyway (the function body is not terminated with }), all bets are off -- and certainly, it does not work fine. -- Christoph M. Becker