Is there a way to execute a JavaScript from the Page_Load event?
Or alternatively, is there a way to have it execute when the page is loaded?
I am defining the script in the Page_Load event and using the
RegisterStartupFunction to add it to the page. I just need a way to execute
the script when the page loads.
Any ideas?
Thanks in advance,
Scott 5 4918
Look into using the body onload event. This JavaScript event will be fired
once the complete file is sent to the user.
HTH MikeL
"Scott Natwick" wrote: Is there a way to execute a JavaScript from the Page_Load event?
Or alternatively, is there a way to have it execute when the page is loaded?
I am defining the script in the Page_Load event and using the RegisterStartupFunction to add it to the page. I just need a way to execute the script when the page loads.
Any ideas?
Thanks in advance, Scott
Thanks, Mike.
I appreciate the response.
I tried triggering the function from the "onload" event of the "body," like
you suggested.
However, the message I get is " undefined:NaN". I think maybe the timing is
off or somthing?
If I add a button to the page and have the button call the function, it
works.
Any thoughts on this?
Thanks again,
Scott
"MikeL" <Mi***@discussions.microsoft.com> wrote in message
news:22**********************************@microsof t.com... Look into using the body onload event. This JavaScript event will be fired once the complete file is sent to the user.
HTH MikeL
"Scott Natwick" wrote:
Is there a way to execute a JavaScript from the Page_Load event?
Or alternatively, is there a way to have it execute when the page is loaded?
I am defining the script in the Page_Load event and using the RegisterStartupFunction to add it to the page. I just need a way to execute the script when the page loads.
Any ideas?
Thanks in advance, Scott
Thanks for the response, Mike.
I tried what you suggest. I added the function call to the "onload" event
of the "body."
However, I received the message " undefined:NaN" as a result of the function
call.
I think maybe the timing may be off?
If I trigger the function call from a button, once the page is loaded, it
works.
Any thoughts?
Thanks again,
Scott
"MikeL" <Mi***@discussions.microsoft.com> wrote in message
news:22**********************************@microsof t.com... Look into using the body onload event. This JavaScript event will be fired once the complete file is sent to the user.
HTH MikeL
"Scott Natwick" wrote:
Is there a way to execute a JavaScript from the Page_Load event?
Or alternatively, is there a way to have it execute when the page is loaded?
I am defining the script in the Page_Load event and using the RegisterStartupFunction to add it to the page. I just need a way to execute the script when the page loads.
Any ideas?
Thanks in advance, Scott
Scott,
It sounds like the JavaScript function is not being loaded onto the page
before the body tag. To see if this is happening save the page as HTML and
open it up in IE. It it works then, then it is a load problem. Try
registering the script in the page load event.
HTH MikeL
"Scott Natwick" wrote: Thanks for the response, Mike.
I tried what you suggest. I added the function call to the "onload" event of the "body."
However, I received the message " undefined:NaN" as a result of the function call.
I think maybe the timing may be off?
If I trigger the function call from a button, once the page is loaded, it works.
Any thoughts?
Thanks again, Scott
"MikeL" <Mi***@discussions.microsoft.com> wrote in message news:22**********************************@microsof t.com... Look into using the body onload event. This JavaScript event will be fired once the complete file is sent to the user.
HTH MikeL
"Scott Natwick" wrote:
Is there a way to execute a JavaScript from the Page_Load event?
Or alternatively, is there a way to have it execute when the page is loaded?
I am defining the script in the Page_Load event and using the RegisterStartupFunction to add it to the page. I just need a way to execute the script when the page loads.
Any ideas?
Thanks in advance, Scott
Mike,
Thanks very much for your help. You nailed it! It's working now.
Scott
"MikeL" <Mi***@discussions.microsoft.com> wrote in message
news:38**********************************@microsof t.com... Scott,
It sounds like the JavaScript function is not being loaded onto the page before the body tag. To see if this is happening save the page as HTML and open it up in IE. It it works then, then it is a load problem. Try registering the script in the page load event.
HTH MikeL
"Scott Natwick" wrote:
Thanks for the response, Mike.
I tried what you suggest. I added the function call to the "onload" event of the "body."
However, I received the message " undefined:NaN" as a result of the function call.
I think maybe the timing may be off?
If I trigger the function call from a button, once the page is loaded, it works.
Any thoughts?
Thanks again, Scott
"MikeL" <Mi***@discussions.microsoft.com> wrote in message news:22**********************************@microsof t.com... > Look into using the body onload event. This JavaScript event will be > fired > once the complete file is sent to the user. > > HTH MikeL > > "Scott Natwick" wrote: > >> Is there a way to execute a JavaScript from the Page_Load event? >> >> Or alternatively, is there a way to have it execute when the page is >> loaded? >> >> I am defining the script in the Page_Load event and using the >> RegisterStartupFunction to add it to the page. I just need a way to >> execute >> the script when the page loads. >> >> Any ideas? >> >> Thanks in advance, >> Scott >> >> >> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Jim Hammond |
last post by:
The script function in the code below works fine when it is JavaScript, but
when I try to use C#, the function doesn't get executed.
<body MS_POSITIONING="GridLayout">
<form id="Form1"...
|
by: Michael SL |
last post by:
Here is my problem. I have a delete record button. I want to prompt the user "Do you really want to delete?". If the user clicks 'OK' then I want to execute the CodeBehind on the server side to...
|
by: Julia |
last post by:
Hi Everyone,
I am using webbrowser control to post data to an aspx page. However, for
some reason, the aspx page sometimes will execute page_load event twice, and
sometimes execute it once. So I...
|
by: Brian Miller |
last post by:
I've been constructing an ASP.Net application using the 1.1 framework,
and have been using Web Matrix for development purposes. Now that my
application is near completion, I wanted to see if I can...
|
by: Ian Kelly |
last post by:
Hi All,
I have an .net form that is split into two frames. The left frame has a
tree that displays a list of all the customers. The right frame displays
the appropriate clients information. ...
|
by: Mark Miller |
last post by:
I've been trying to execute a javascript function just before submit on a
form that contains an <input type="file"> input field and it isn't working.
The reason I want to do this is the end users...
|
by: Edwin Knoppert |
last post by:
I post this again, no answer before.
During the beta version it worked, the same code does no longer work in the
new release.
I have a simple gridview with ButtonField, the button deletes a...
|
by: anadimpa |
last post by:
Hello all
I build a javascript function string in the code behind and register it in
the Page_Load of my User Control. I do this because I build the javascript
based on some variables that are...
|
by: Ben |
last post by:
Hi,
When a user wants to start the application, aspnet checks a boolean value in
a field of the database.
If that value is 'false', then i want to execute a ALERT in javascript
telling the...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
| |