Get onload to occur first before Page_Load

G

Guest

Hi,

I have a form with a javacript function that I wish to call before the
Page_Load event on the server side. The function is called in the onload of
window (ie. window.onload = "myfunction()"

Is this possible? If so how, If not is there a workaround ?
 
M

Marina Levit [MVP]

The javascript onload happens after the browser has loaded the HTML returned
by the server and parsed it.

In order for the server to return the HTML, it has to process the IIS
request, and then process the page. This involves calling the various page
events, including the Load event.

So, you see, without the HTML, there is no way to run any javascript events.

And without the Load event being fired (among many other things happening),
there is no way to get the HTML to the browser.

Consider the order of events that happen when you browser requests a page
from the server, and you will see that what you are asking for is not
possible and doesn't even really make sense in terms of how web applications
work.
 
G

Guest

Yes, this is what I thought. The page is not fully rendered to the browser
an hence the javacript does not exist. I will work around the problem.
Thanks for your help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,782
Latest member
ThomasGex

Latest Threads

Top