Periods in Javascript function definition (function window.onload(){}) [closed]
- by nemec
Possible Duplicate:
JavaScript Function Syntax Explanation: function object.myFunction(){..}
I've seen some (legacy) javascript code recently that looks like:
function window.onload(){
// some code
}
This doesn't look like valid javascript to me since you can't have a period in an identifier, but it seems to work in IE8. I assume it's the equivalent of:
window.onload = function(){}
I've tried the same code in Chrome and IE9 and both of them raise syntax exceptions, so am I correct in thinking that this "feature" of IE8 is some non-standard function definition that should be replaced? The code in question is only sent to IE browsers, so that's probably why I haven't run into this issue before.