Populate text box with JavaScript on PageLoad

Posted by Etienne on Stack Overflow See other posts from Stack Overflow or by Etienne
Published on 2010-05-25T11:37:39Z Indexed on 2010/05/25 11:41 UTC
Read the original article Hit count: 224

I have a text box called txtName on my form.

In my page I know I need to place the code in my HEAD tag like so......

<script type='text/javascript' language="javascript">

 document.forms['FormName'].elements['txtName'].value = "Robert"

 </script> 

But I cant seem to set a value inside my text box.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about JavaScript