You can achieve it by doing like this
<html>
<script language="text/javascript">
var test=DValue;
document.myForm.name.value=test;
</script>
<body>
<form name="myForm">
<inpu type="text" name="name"/>
</form>
</body>
</html>
hi ... we have to correct some things here:
[HTML]
<html>
<script type="text/javascript">
function set_field() {
var test = 'DValue';
document.myForm.name.value = test;
}
</script>
<body onload="set_field();">
<form name="myForm">
<input type="text" name="name"/>
</form>
</body>
</html>[/HTML]
explaination: its the script-type to set, and we have to wrap the code in a function that we call onload of the body, until the textbox has to be loaded and rendered first by the browser. the way you want to do it ... means the script is executed during load ... before the document is ready to use ... so we wait for it and then call the set_field() method ... try it if you're wondering why it is not working. and DValue would be a variable in your code ... that is undefined here and the script will stop with an error for this ... so use a stringvalue here or declare the variable ... and assign a value to it ...
kind regards ...