Click to See Complete Forum and Search --> : ASP TextBox with javascript


Zcumbag
December 19th, 2006, 03:17 AM
Hi.

I'm currently trying to create a form that consists of a number of textboxes. One of these textboxes i plan to hold the current time offset to the UTC. I have the javascript code to do this. What I haven't figured out is how to get this value inte the textbox?

<asp:TextBox runat="server" Text="<%= Response.Write('javascript:getClientTime();')%>"></asp:TextBox>

is one of example of what doesn't work.

Any ideas?

Thanks!

karim_medusa
December 19th, 2006, 09:21 AM
Hi,

javascript run on client , but you use server control asp:textbox which run on server .
if you want use javascript code , you must use html control like
<input type="text" name="textbox1" value="javascript:getClientTime();">

Alsvha
December 19th, 2006, 12:53 PM
Hi.

I'm currently trying to create a form that consists of a number of textboxes. One of these textboxes i plan to hold the current time offset to the UTC. I have the javascript code to do this. What I haven't figured out is how to get this value inte the textbox?

<asp:TextBox runat="server" Text="<%= Response.Write('javascript:getClientTime();')%>"></asp:TextBox>

is one of example of what doesn't work.

Any ideas?

Thanks!

Call the javascript function after the page is submitted to the client to set the value of the - then rendered - textbox.