Skip to content Skip to sidebar Skip to footer

Why I Can't Make A Jsfiddle Of This Working Code?

My code works perfectly on my computer, on all my browsers (including ie), But I can't manage to make it work on jsFiddle. The problem seems to be on: window.onload=function(){

Solution 1:

It works ok, see here

PS: You should select the no wrap (head) option.

Solution 2:

If you view the source of a jsFiddle you will see that all the javascript is already wrapped in the window.onload function.

After the outer window.onload function is called, the inner function won't execute because the document is already loaded:

window.onload=function(){
    window.onload=function(){
        // this code will never get executed.
    }
}

Post a Comment for "Why I Can't Make A Jsfiddle Of This Working Code?"