> function testFunction(i) {
> var b = i+1;
> document.write(b);
> setTimeout("testFunction(b)", 3000);}
You define 'b' as a variable local to testFunction().
After you've called the setTimeout, testFunction finishes and b ceases
to exist.
When the timeout is expired, it runs in global scope, and calls
testFunction(null) because there is no 'b'.
Try this
var b ; // this is a global variable, it persists
function testFunction() {
b = b+1;
document.write(b);
setTimeout("testFunction(b)", 3000);}
See this
http://econym.org.uk/gmap/scope.htm
or this
http://www.webdevelopersnotes.com/tutorials/javascript/global_local_variables_scope_javascript.php3
and so on
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-maps-api?hl=en
-~----------~----~----~----~------~----~------~--~---