codice:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Code Example by DYNAMIC+</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Language" content="en-us" />
<script type="text/javascript">
<!--
function scrivi( )
{
document.forms['form1'].elements['testo'].value = "Andrea";
}
//-->
</script>
</head>
<body>
<div>
<form name="form1" method="post" action="prova.html" onsubmit="scrivi( );">
<label>
<input type="text" name="testo" value="" />
<input type="submit" name="Submit" value="Invia" />
</label>
</form>
</div>
</body>
</html>
ps: l'indentazione è importante!