Search code examples
javascriptinternet-explorerwindowonload

Javascript: window.onload problem


This isn't working in IE (although it does work in FFX). Why?

Using HTML in the header:

<script type="application/javascript">

    // And finally, let's call the code ourselves.
    window.onload = lbp.init;

</script>

And then the script:

// lbp is the script's universal variable, which retains everything
var lbp = {};

// The sequence of functions to trigger
lbp.init = function() {
    alert('hi');
}

Thanks in advance for your help =)


Solution

  • I don't know if IE supports application/javascript. Did you try text/javascript?

    Also: is lbp initialized before setting window.onload?