asp.net - Javascript after window.onload? -


I have an asp.net page that loads some javascript, one of those scripts loads certain controls in the page So that they connect the body to the window.onload event.

I need to inject a script behind the code to call a script, depending on the scripts that are made in the window. This does not work because every call I make it forever and controls are not made at this time. If I call it, for example, the onclick in the hyperlink works because the control was already created in onload .

Then: 1 - & lt; Script type = "text / javascript" src = "/ script / somefile.js" & gt; & Lt; / Script & gt;

2 - addEvent (window, "load", blubal); - JS creates some control over the body which is added to the body on the Ollod program

3 - In the back code, I try to write a script on the page this.Page .clientScript.RegisterStartupScript or this.Page.ClientScript.RegisterClientScriptBlock or whatever method should call a method above .js, depending on the loaded control, the onload event But this step fails because the control is not yet in the DOM.

window.onload Any suggestions on how to call after the event

Create an array of functions:

  & lt; Script & gt; Var onLoadFunctions = []; Function addOnLoad (funcName) {onLoadFunctions [onLoadFunctions.length] = funcName; } Function executeOnLoad () {for (var i = 0; i & lt; onLoadFunctions.length; i ++) onLoadFunctions [i] (); } AddOnLoad (Forbes); AddOnLoad (blabla); AddOnLoad (theother); Window.onload = executeOnLoad; & Lt; / Script & gt;  

Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -