|
|
|
start date: Sat, 18 Aug 2007 15:14:13 -0700,
posted on: microsoft.public.dotnet.framework.aspnet
back
| Thread Index |
|
1
Mike McIntyre
|
|
2
Steve C. Orr [MCSD, MVP, CSM, ASP Insider]
|
|
3
Mark Rae [MVP]
|
|
4
Mike McIntyre
|
|
5
Kevin Spencer
|
|
6
Steve Kershaw
|
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
Date:Sat, 18 Aug 2007 15:14:13 -0700
Author:
|
Re: Call JavaScript Function
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" wrote in message
news:eV9$cUe4HHA.5844@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
>
>
>
Date:Sat, 18 Aug 2007 15:20:30 -0700
Author:
|
Re: Call JavaScript Function
On Aug 18, 4:20 pm, "Steve C. Orr [MCSD, MVP, CSM, ASP Insider]"
wrote:
> 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" wrote in message
>
> news:eV9$cUe4HHA.5844@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(Page), "ScriptName",
strScript);
That should do it.
Steve
Date:Sat, 18 Aug 2007 16:26:23 -0700
Author:
|
Re: Call JavaScript Function
"Steve Kershaw" wrote in message
news:1187479583.023981.220710@i13g2000prf.googlegroups.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/library/z9h4dk8y(VS.80).aspx
--
Mark Rae
ASP.NET MVP
http://www.markrae.net
Date:Sun, 19 Aug 2007 08:22:42 +0100
Author:
|
Re: Call JavaScript Function
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" wrote in message
news:1187479583.023981.220710@i13g2000prf.googlegroups.com...
> On Aug 18, 4:20 pm, "Steve C. Orr [MCSD, MVP, CSM, ASP Insider]"
> wrote:
>> 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" wrote in message
>>
>> news:eV9$cUe4HHA.5844@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(Page), "ScriptName",
> strScript);
>
> That should do it.
>
> Steve
>
Date:Mon, 20 Aug 2007 18:40:22 -0700
Author:
|
Re: Call JavaScript Function
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" wrote in message
news:uwdqAR54HHA.1212@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" wrote in message
> news:1187479583.023981.220710@i13g2000prf.googlegroups.com...
>> On Aug 18, 4:20 pm, "Steve C. Orr [MCSD, MVP, CSM, ASP Insider]"
>> wrote:
>>> 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" wrote in message
>>>
>>> news:eV9$cUe4HHA.5844@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(Page), "ScriptName",
>> strScript);
>>
>> That should do it.
>>
>> Steve
>>
>
>
Date:Tue, 21 Aug 2007 07:16:04 -0400
Author:
|
|
|