Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #26749

Re: Problem determining iFrame source url ...

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" <cmbecker69@arcor.de>
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 <madelm$r7p$1@solani.org> (permalink)
References <c47f984c-b560-4c77-ac64-09a08a43ada7@googlegroups.com> <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

Show key headers only | View raw


Tim Streater wrote:

> In article <c47f984c-b560-4c77-ac64-09a08a43ada7@googlegroups.com>,
> sean mc <seanmc1217@gmail.com> wrote:
> 
>> below, it works fine....sort of... :
>> --------------------------------------------------------
>> <script type="text/javascript">
>> function ChangeSrc() {
>>  var frames = Array('splash.html', 4,
>>      'data.html');
>>  var i = 0, len = frames.length;
>>  document.getElementById('data_frame').src = frames[i++];
>>  if (i >= len) return; // no more changing
>>  setTimeout('ChangeSrc()', (frames[i++]*1000));
>> //}
>>
>> window.onload = ChangeSrc;
>> </script>
>> --------------------------------------------------------
> 
> 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

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Problem determining iFrame source url ... sean mc <seanmc1217@gmail.com> - 2015-01-29 05:20 -0800
  Re: Problem determining iFrame source url ... Tim Streater <timstreater@greenbee.net> - 2015-01-29 13:39 +0000
    Re: Problem determining iFrame source url ... sean mc <seanmc1217@gmail.com> - 2015-01-29 05:58 -0800
    Re: Problem determining iFrame source url ... "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-01-29 15:04 +0100
      Re: Problem determining iFrame source url ... sean mc <seanmc1217@gmail.com> - 2015-01-29 06:25 -0800
        Re: Problem determining iFrame source url ... sean mc <seanmc1217@gmail.com> - 2015-01-29 06:31 -0800
        Re: Problem determining iFrame source url ... sean mc <seanmc1217@gmail.com> - 2015-01-29 08:09 -0800
  Re: Problem determining iFrame source url ... sean mc <seanmc1217@gmail.com> - 2015-01-29 08:22 -0800
  Re: Problem determining iFrame source url ... sean mc <seanmc1217@gmail.com> - 2015-01-29 16:14 -0800
    Re: Problem determining iFrame source url ... "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-01-30 10:25 +0100
      Re: Problem determining iFrame source url ... sean mc <seanmc1217@gmail.com> - 2015-01-30 06:53 -0800
  Re: Problem determining iFrame source url ... sean mc <seanmc1217@gmail.com> - 2015-01-30 12:45 -0800
    Re: Problem determining iFrame source url ... "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-01-30 23:25 +0100
      Re: Problem determining iFrame source url ... "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-01-30 23:57 +0100
        Re: Problem determining iFrame source url ... sean mc <seanmc1217@gmail.com> - 2015-01-30 17:53 -0800
      Re: Problem determining iFrame source url ... sean mc <seanmc1217@gmail.com> - 2015-01-30 17:59 -0800

csiph-web