Q:

run a javascript function automaticall in a aspx page

I have in input control in my page that run a query,I want run this query just between two time for e.g 8:00 AM TO 4:00 PM.
I use a Timer control , but i dont know what code i write in Timer1_Tick becuse my button is html control and it run a javascript function.I want run this function automatiacally( in 8:00 am to 4:00 pm) without any press button control .how can i run this function or click event automatically?
<div id="tab4">  
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">  
        <Triggers>  
        <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />  
        </Triggers>  
        <ContentTemplate>   
        <input type="button" value="Run query" onclick="RunQuery(this)"> </input>  

        </ContentTemplate>  
        </asp:UpdatePanel> 

How can i do it?,
please help me

A:

If you just want to run the javascript function at a specific time you could use the "setTimeout" method to schedule your function execution. For example, the following code displays a message at 20:30 PM of the current day:
var date = new Date();
date.setHours(20, 30, 00, 0);
setTimeout("alert('It is time!')", date.getTime() - (new Date()).getTime());​​​​​​​

You can easily create a function to wrap the code above and apply it to your case. Then just bind it to the Sys.Application.load Event.

