hola tengo un chat que envio el texto pulsando sobre el boton enviar el problema esta en cuanto presiono el enter no me lo envia
<form name="message" action="">
<table width="240" border="0" align="center">
<input name="usermsg" type="text" id="usermsg" size="63" />
<input name="submitmsg" type="submit" id="submitmsg" value="Enviar" />
</form>
y este es el script que usa
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript">
// jQuery Document
$(document).ready(function(){
//If user submits the form
$("#submitmsg").click(function(){
var clientmsg = $("#usermsg").val();
$.post("mercadillos/<?php echo $dni; ?>/post.php", {text: clientmsg});
$("#usermsg").attr("value", "");
return false;
});
//Load the file containing the chat log
function loadLog(){
var oldscrollHeight = $("#chatbox").attr("scrollHeight") - 20;
$.ajax({
url: "mercadillos/<?php echo $dni; ?>/log.html",
cache: false,
success: function(html){
$("#chatbox").html(html); //Insert chat log into the #chatbox div
var newscrollHeight = $("#chatbox").attr("scrollHeight") - 20;
if(newscrollHeight > oldscrollHeight){
$("#chatbox").animate({ scrollTop: newscrollHeight }, "normal"); //Autoscroll to bottom of div
}
},
});
}
setInterval (loadLog, 2500); //Reload file every 2.5 seconds
//If user wants to end session
$("#exit").click(function(){
var exit = confirm("Estas seguro de querer salir del chat?");
if(exit==true){window.location = "tienda.php?num=<?php echo $mercadillo; ?>&logout=true";}
});
});
</script>