Check this out hope it may help you,
<script type="text/javascript">
function OnButtonClick() {
var textcontrol = document.getElementById("txtname");
textcontrol.value = "Arun";
}
</script>
<pre lang="HTML">
<input type="text" id="txtname" />
<input type="button" id="btnsubmit" onclick="OnButtonClick()" value="Submit" />