Hi
how to break/stop code if statement met on loop?
for example insde https://google.com/update.php?id=2 the page shows or output a text "Can't Update" and the loop for openNext() will stop?
it won't load the next array
Thanks
how to break/stop code if statement met on loop?
for example insde https://google.com/update.php?id=2 the page shows or output a text "Can't Update" and the loop for openNext() will stop?
it won't load the next array
Thanks
Code:
<iframe id='the_iframe'></iframe>
<script>
var urls = [
'https://google.com/update.php?id=1',
'https://google.com/update.php?id=2',
'https://google.com/update.php?id=3',
'https://google.com/update.php?id=4'
];
function openNext(){
document.getElementById('the_iframe').src = urls.shift();
if(urls.length)setTimeout('openNext()',3000);
}
openNext();
</script>
Last edited: