Ciao ho risolto così:
Codice PHP:
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>chat</title>
<script type="text/javascript">
function mexchat(){
if(document.formchat.testo.value.length > -1){
document.getElementById ("mex").firstChild.nodeValue = "Damiano sta scrivendo...";
}
}
</script>
</head>
<body>
<div id="chat">
<form method="post" action="#" name="formchat">
<table border="1px">
<tr>
<td id="mex" colspan="2">Damiano </td>
</tr>
<tr><td><input type="text" name="testo" onkeypress="mexchat();" /></td>
<td><input type="submit" value="invia"/></td>
</tr>
</table>
</form>
</div>
</body>
</html>
Non so perchè ma il conto dei caratteri parte da -1