Writing Javascript to end of page

  • Thread starter Thread starter Mark
  • Start date Start date
M

Mark

Hi - I have a component, which sends some Javascript to the page.

I have a registerclientscriptblock which writes some Javascript which
when the page is loaded, references a textbox written to the page by the
component.

However, my javascript gets written to the page before the components
javascript, so when my script runs, the textbox being referenced doesn't
exist yet.

Is there any way to ensure my script, written by the
registerclientscriptblock, gets written to the end of the page, after
all other javascript?

Thanks, Mark
 
Hi,

You don't need a script at the end of the page, but a script which is
executed after the page loads:

window.onload = function() {
// JavaScript-Code goes here and is executed *after* the page
loads...
}

--
Karsten Samaschke
IT-Consulting, IT-Development, IT-Training
5x MS MVP ASP / ASP.NET, Germany
Homepage: http://www.ksamaschke.de
Weblog: http://www.karsan.de
- - - - - - - - - - - - - - - - - - - - - - - - - -
My Weblog: http://www.karsan.de
My Books: http://books.ksamaschke.de
 
Use RegisterStartupScript instead, which does (and is meant to do) exactly
what you want :)

karl
 
Back
Top