Adding another window.onload event in the Javascript for ASP.NET

For example If we are using two user controls having window.onload() event, it gives a problem to load two window.onload event.

For this we have to use microsoft specific or require bloated libraries. Please go through below code, how it works with W3C-compliant browsers and with Microsoft IE.

if (window.addEventListener) // this is W3C standard
  window.addEventListener('load', exampleFunction(), false); // NB **not** 'onload'

else if (window.attachEvent) // this is Microsoft specific
  window.attachEvent('onload', );

If you have any queries or suggestions, please fell free to ask in comments section.
Share this post :

Post a Comment

Please give your valuable feedback on this post. You can submit any ASP.NET article here. We will post that article in this website by your name.

Support : Ranga Rajesh Kumar
Copyright © 2012. ASP.NET Examples - All Rights Reserved
Site Designed by Ranga Rajesh Kumar