It's no longer working in Firefox.
This happens with FireFox, Chrome and IE ... so it leads me to believe that everything is executed in order once the page is loaded.
<html>
<script>
window.onload = a();
document.write("This is not a function. <br>");
function a(){
document.write("This is a function. <br>");
}
</script>
</html>
I cannot remember the books I've read any more than the meals I have eaten; even so, they have made me.
~ Ralph Waldo Emerson
No, it does not happen with Chrome. Indeed, it didn't happen in Firefox 37... I know because up to 38.01 my game maker was working on it.
I'll bet it broke on 38.01.
...Which really shouldn't have happened. They should have had something to test such basic, essential functionality.
38.0.6 is the current FF version.
I still am getting the exact same behavior in all three browsers.
I cannot remember the books I've read any more than the meals I have eaten; even so, they have made me.
~ Ralph Waldo Emerson
The issue you seem to be having is the .onload functionality.
Using your code, I received the same results in all thee browsers as before.
<html>
<script>
ima = new Image();
ima.onload = a();
ima.src = "/exp.png";
document.write("This is not a function. <br>");
function a(){
document.write("This is a function. <br>");
}
</script>
</html>
.
.
.onload firing before images are loaded seems to be a common issue some folks have according to Google [LINK]
I cannot remember the books I've read any more than the meals I have eaten; even so, they have made me.
~ Ralph Waldo Emerson
Please keep in mind that "this doesn't work the way I expect it to" and "this doesn't work they way it uesd to" are not necessarily bugs.
The real issue here seems to be that you have written code that assumes certain behavior which is not actually guaranteed.
The real issue here seems to be that you have written code that assumes certain behavior which is not actually guaranteed.
FTFY.
This needs to be engraved somewhere on at every web developer'sworkspaceskull, with a pickaxe.
"I AM ZE EMPRAH OPENGL 3.3 THE CORE, I DEMAND FROM THEE ZE SHADERZ AND MATRIXEZ"
My journals: dustArtemis ECS framework and Making a Terrain Generator