Expand|Select|Wrap|Line Numbers
- <script>
- window.onload=function() {test();}
- /*######################## iam_clint ########################
- Please take note that I am not globally declaring anything
- if you change the for loops to be for(var i=0; that actually resolves the problem.
- ######################################################*/
- function test() {
- test_global="This isn't supposed to be global.";
- for (i=0; i<=10; i++) {
- alert("test " + i);
- test2();
- }
- if (i>10) { alert("i is greater than 10 (" + i + ")"); }
- test3();
- }
- function test2() {
- for (i=0; i<=10; i++) {
- c=2;
- }
- }
- function test3() {
- alert(test_global);
- }
- </script>