Hola, el script mete en el head de la pagina:
Código HTML:
<html>
<head>
Aqui el script
</head>
<body>
...
</body>
</html>
y abrelo siempre asi:
Código HTML:
<script type="text/javascript">
</script>
si es en un fichero externo:
Código HTML:
<script type="text/javascript" src="javascript.js">
</script>
y utliza siempre getElementByID para cambiar valores de los campos.
Para terminar valida siempre tu codigo html:
http://validator.w3.org
suerte