sean mc
1/29/2015 2:25:00 PM
On Thursday, January 29, 2015 at 9:04:43 AM UTC-5, Christoph M. Becker wrote:
> Tim Streater wrote:
>
> > In article <c47f984c-b560-4c77-ac64-09a08a43ada7@googlegroups.com>,
> > sean mc 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
OK...I apologise..I see what was being pointed out.
I wasnt trying to sound snarky with my last reply...I just didnt see what was being pointed out, obviously. Function "ChangeSrc" is terminated correctly in my code I believe...am I missing it? Somehow it got commented out in the re-post...but I believe that closing "}" is present in my initial post without being commented out. I believe this was another Copy/Paste error. My apologies.
Sorry...that declaration of i=0 is supposed to be outside. That mistake was also somehow made by me when I was copying and pasting my code into the group editor.
My error....again...my apologies.
Now...back to my original statement ...my pages will increment correctly, and load into my ifrmame as expected...until I added the function :
function GetIFrameURL (iFrm) {
if (isChromeBrowser() == true) {
var fUrl = iFrm.contentDocument.location.href;
}
else {
var fUrl = iFrm.contentWindow.location.href;
}
return fUrl;
}
It goes through this the first time
var fUrl = iFrm.contentDocument.location.href; returns "about:blank" the first time thru.
The second time thru, it hit this line, and execution just stops.