OK. Thanks a lot for the help.
I've though to use setInterval(), but I wanted to understand why this brakes.
Thank you again for the explanation!
User Profile
Collapse
-
Hi,
Here is nice article about variable scope in Javascript:
http://www.thescripts.com/forum/thread655478.html
Check your IFs statements, because if they are not TRUE neither of all loops you will not set the array any value.
( Sorry for the bad English )...Leave a comment:
-
When you call c, you print the whole array at once.
You need to walk through the elements with loop one by one.
Here sample code:
[CODE=javascript]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript">
c = new Array( "Apple",...Leave a comment:
-
May be there is problem with line breaks, because file is created with gnu/linux editor and some windows editors show it as one line.
This is the code in the js file:
[CODE=javascript]function cDestroyer( node, it ){
if( !node){ var node = document.body }
var stuffToDestroy = node.childNodes ;
if( it ){ it = parseInt(it);}
if( !it ) { it= stuffToDestroy. length - 1;}// we...Leave a comment:
-
setTimeout() recursion problem
Hello,
I'm currently studying javascript by myself.
I thought that I will write js that will remove element in the body from DOM every 2 seconds, untill all elements in the body are deleted( except debug <span> :) )
At first I tried to go through the elements with loop, but when I call setTimeout() the loop doesn't wait setTimeout() to end, but it continues looping.
Now I use recursion. setTimeout()...
No activity results to display
Show More
Leave a comment: