NULL: Inputfeld leeren

Beitrag lesen

Warum leert der folgende Code das Input-Feld namens "chat" nicht ???

<html>
<head>
<script language="Javascript">
function doSubmit()
{
   if(document.chatform.chat.value == '')
   {
      alert('Please enter some text!');
      document.chatform.chat.focus();
      return false;
   }

document.chatform.submit();
   document.chatform.chat.value = '';
   document.chatform.chat.focus();
   return true;
}
</script>

</head>
<body style="background-color:#B8D3EF">
<form onSubmit="return doSubmit" action="chat.php" method="POST" target="chatwindow" name="chatform">
<input type="text" name="chat">
<input type="submit" value="send">
</form>

</body>
</html>