473,327 Members | 2,069 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Writing Javascript to end of page

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

*** Sent via Developersdex http://www.developersdex.com ***
Nov 20 '05 #1
2 3184
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

Nov 20 '05 #2
Use RegisterStartupScript instead, which does (and is meant to do) exactly
what you want :)

karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
http://openmymind.net/redirector.aspx?documentId=51 - Learn about AJAX!

"Mark" <an*******@devdex.com> wrote in message
news:uw**************@TK2MSFTNGP11.phx.gbl...
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

*** Sent via Developersdex http://www.developersdex.com ***

Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Christoph Bergmann | last post by:
Hi... We want to write an open source web based TEXT editor and would be happy about any help ;-) Please notice: We do NOT want to write a web based WEB editor, where you can edit a web...
9
by: Robby Bankston | last post by:
I'm working on some code and am running into brick walls. I'm trying to write out Javascript with Javascript and I've read the clj Meta FAQ and didn't see the answer, read many similar posts (with...
17
by: Eric Lindsay | last post by:
Is learning to write CSS a better use of time than finding and using a package that produces complete web pages? I've moved to a new platform (Macintosh), taking with me about 400 personal web...
2
by: Stephen | last post by:
I have code which checks whether a datagrid is empty and if it is it shows a panel on my page. If its not empty then Im using the server.transfer to go to another page so as im able to use the...
3
by: Csaba Gabor | last post by:
Firefox's configuration settings (Prefs.js) can be accomplished via the interface at about:config. Q1. Is there any such setting that can be repeatedly altered via javascript (in a vanilla...
3
by: jonnyblazed | last post by:
Okay..... I'm gonna sum up what I want to do cause it will make it pretty simple for you guys to understand. Here we go: I have a form that posts data to a PHP mailer page I have created. When...
15
by: Cerebral Believer | last post by:
Hi all, I am a newbie to JavaScript and am just trying to get a script going that will write the ful date and time to each webpage as it is viewed. Can anyone point out what mistakes there are...
1
by: Wayne | last post by:
I have an application that has over 150 pages. Within each page there are between 2 and 10 Iframes. As you can imagine the back button doesn't work very well. For the pages that are loaded...
2
by: fulio pen | last post by:
Hello: I failed to display a Chinese character with javascript code in following svg page: http://www.pinyinology.com/test/hanzi2.svg I guess that something is missing or wrong in the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.