473,395 Members | 1,762 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,395 software developers and data experts.

Call JavaScript Function

What event can be used to call a JavaScript function when the page loads AND
when it receives a response from the web server?

Thanks,

--
Mike

Mike McIntyre [MVP]
http://www.getdotnetcode.com

Aug 18 '07 #1
5 1800
The body's onload event is raised when the page has been fully loaded.
I'm not sure what you mean about "when it receives a response from the web
server".

--
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider
http://SteveOrr.net

"Mike McIntyre" <mi****@getdotnetcode.comwrote in message
news:eV**************@TK2MSFTNGP02.phx.gbl...
What event can be used to call a JavaScript function when the page loads
AND when it receives a response from the web server?

Thanks,

--
Mike

Mike McIntyre [MVP]
http://www.getdotnetcode.com
Aug 18 '07 #2
On Aug 18, 4:20 pm, "Steve C. Orr [MCSD, MVP, CSM, ASP Insider]"
<St...@Orr.netwrote:
The body's onload event is raised when the page has been fully loaded.
I'm not sure what you mean about "when it receives a response from the web
server".

--
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsiderhttp://SteveOrr.net

"Mike McIntyre" <mik...@getdotnetcode.comwrote in message

news:eV**************@TK2MSFTNGP02.phx.gbl...
What event can be used to call a JavaScript function when the page loads
AND when it receives a response from the web server?
Thanks,
--
Mike
Mike McIntyre [MVP]
http://www.getdotnetcode.com- Hide quoted text -

- Show quoted text -
In the Page_Load method use:

string strScript = @"<script language=""javascript"">
window.alert(""put your script here""); </script>";
Page.ClientScript.RegisterStartupScript(typeof(Pag e), "ScriptName",
strScript);

That should do it.

Steve

Aug 18 '07 #3
"Steve Kershaw" <st***********@yahoo.comwrote in message
news:11**********************@i13g2000prf.googlegr oups.com...
string strScript = @"<script language=""javascript"">
That usage is deprecated because it's not XHTML-compliant - instead, use:

string strScript = "<script type=\"text/javascript\">

Or, even better, use the overloaded method of RegisterStartupScript which
adds in the script tags automatically:
http://msdn2.microsoft.com/en-us/lib...8y(VS.80).aspx
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 19 '07 #4
This seems to fire only when the page is first loaded into the browser - not
each time the page gets a response from the server.

--
Mike

Mike McIntyre [MVP]
http://www.getdotnetcode.com
"Steve Kershaw" <st***********@yahoo.comwrote in message
news:11**********************@i13g2000prf.googlegr oups.com...
On Aug 18, 4:20 pm, "Steve C. Orr [MCSD, MVP, CSM, ASP Insider]"
<St...@Orr.netwrote:
>The body's onload event is raised when the page has been fully loaded.
I'm not sure what you mean about "when it receives a response from the
web
server".

--
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsiderhttp://SteveOrr.net

"Mike McIntyre" <mik...@getdotnetcode.comwrote in message

news:eV**************@TK2MSFTNGP02.phx.gbl...
What event can be used to call a JavaScript function when the page
loads
AND when it receives a response from the web server?
Thanks,
--
Mike
Mike McIntyre [MVP]
http://www.getdotnetcode.com- Hide quoted text -

- Show quoted text -

In the Page_Load method use:

string strScript = @"<script language=""javascript"">
window.alert(""put your script here""); </script>";
Page.ClientScript.RegisterStartupScript(typeof(Pag e), "ScriptName",
strScript);

That should do it.

Steve

Aug 21 '07 #5
The Page_Load event fires whenever the Page is requested. I believe that by
"the page gets a response from the server" you are referring to a PostBack.
The Page doesn't get a response from the server. The browser does, every
time it requests a Page. But the Page_Load event fires with each response,
not just the initial (non-PostBack) response.

--
HTH,

Kevin Spencer
Microsoft MVP

DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

"Mike McIntyre" <mi****@getdotnetcode.comwrote in message
news:uw**************@TK2MSFTNGP05.phx.gbl...
This seems to fire only when the page is first loaded into the browser -
not each time the page gets a response from the server.

--
Mike

Mike McIntyre [MVP]
http://www.getdotnetcode.com
"Steve Kershaw" <st***********@yahoo.comwrote in message
news:11**********************@i13g2000prf.googlegr oups.com...
>On Aug 18, 4:20 pm, "Steve C. Orr [MCSD, MVP, CSM, ASP Insider]"
<St...@Orr.netwrote:
>>The body's onload event is raised when the page has been fully loaded.
I'm not sure what you mean about "when it receives a response from the
web
server".

--
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsiderhttp://SteveOrr.net

"Mike McIntyre" <mik...@getdotnetcode.comwrote in message

news:eV**************@TK2MSFTNGP02.phx.gbl...

What event can be used to call a JavaScript function when the page
loads
AND when it receives a response from the web server?

Thanks,

--
Mike

Mike McIntyre [MVP]
http://www.getdotnetcode.com- Hide quoted text -

- Show quoted text -

In the Page_Load method use:

string strScript = @"<script language=""javascript"">
window.alert(""put your script here""); </script>";
Page.ClientScript.RegisterStartupScript(typeof(Pa ge), "ScriptName",
strScript);

That should do it.

Steve


Aug 21 '07 #6

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

Similar topics

15
by: chirs | last post by:
I am trying to understand a piece of code. In a javascrpit file, there is a function: function ItemStyle(){ var names=; addProps(this,arguments,names,true); }; In the html file, it calls...
5
by: Sue | last post by:
After finishing up my first quarter JavaScript on 12/12/03, I decided to improve character checking on my project. In my project I only had to do very basic validation. Therefore, I only had one...
1
by: cheezebeetle | last post by:
ok, so I am having problems passing in an ASPX function into the Javascript in the codebehind page. I am simply using a confirm call which when they press "OK" they call this ASPX function, when...
3
by: JoeK | last post by:
Hey all, I am automating a web page from Visual Foxpro. I can control all the textboxes, radio buttons, and command buttons using syntax such as: ...
39
by: Randell D. | last post by:
Folks, I'm sure this can be done legally, and not thru tricks of the trade - I hope someone can help. I'm writing a 'tool' (a function) which can be used generically in any of my projects. ...
18
by: Chris Ianson | last post by:
Hi geniuses (or is that genii, or genies) The challenge is as above really. I have a page with an iframe in it, and need to call a JS function in the *parent* page, *from* inside the iframe. ...
3
by: KaNos | last post by:
Hi, "robot script pages" are html+javascript pages, can be played in aspx player. So in this tech, robot call aspx player's function (an interface is sheared) and wait a result synchronously with...
3
by: Angus | last post by:
I have a web page with a toolbar containing a Save button. The Save button can change contextually to be a Search button in some cases. Hence the button name searchsavechanges. The snippet of...
10
by: evicailieva | last post by:
A have a php scrip where I call a JavaScript function. I don't know why, but it doesn't work. At the beginning, when I was writing the script it was working but now it's not. I don't know wхat to do....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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...
0
BarryA
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
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,...
0
Oralloy
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,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.