Foros del Web » Programando para Internet » Javascript »

Problemas javascript

Estas en el tema de Problemas javascript en el foro de Javascript en Foros del Web. hola , tengo un problema tengo un textbox multiline y quiero que cuando presione ENTER me ejecute un boton que tiene codigo en servidor. lo ...
  #1 (permalink)  
Antiguo 03/06/2012, 12:54
 
Fecha de Ingreso: junio-2008
Mensajes: 22
Antigüedad: 15 años, 10 meses
Puntos: 0
Pregunta Problemas javascript

hola , tengo un problema tengo un textbox multiline y quiero que cuando presione ENTER me ejecute un boton que tiene codigo en servidor. lo hago de la sgte manera:

codigo javascript:

<script type="text/javascript">
function fr_Enter(e) {
var evento = e ? e : window.event;
if (evento.keyCode == 13) {
var btnEnviar = document.getElementById('<%=btnSend.ClientID%>');
btnEnviar.click();
return false;
}
}
</script>

En codgio servidor con C#:

private void pr_RegistrarJS()
{
this.txtMsg.Attributes.Add("onkeypress", "return fr_Enter(event)");
}

como es una ventana de CHAT lo que estoy haciendo cuando escribo presiono ENTER y no hay problema pero en la TERCERA vez que escribo en la caja ya no me deja como que se desactiva el teclado y no me deja escribir nada.

Espero me ayuden y gracias por sus respuestas de antemano, es Urgente por favorrrrr.
  #2 (permalink)  
Antiguo 04/06/2012, 06:53
 
Fecha de Ingreso: junio-2012
Ubicación: Alicante
Mensajes: 44
Antigüedad: 11 años, 10 meses
Puntos: 6
Respuesta: Problemas javascript

Hola george180;

Primeramente decirte que deberías poner tu código entre las etiquetas para una mejor visibilidad.

En segundo lugar, creo que el código del evento click de tu btnEnviar también es bastante importante que lo pongas.


Un saludo.
  #3 (permalink)  
Antiguo 04/06/2012, 22:27
 
Fecha de Ingreso: junio-2008
Mensajes: 22
Antigüedad: 15 años, 10 meses
Puntos: 0
Pregunta Respuesta: Problemas javascript

<tr> <td>
<asp:Panel ID="msgPanel" Font-Names="verdana" Font-Size="8pt" runat="server" Height="230px"
Width="248" BorderStyle="Solid" BorderWidth="1pt">
</asp:Panel>
</td>
</tr>
<tr>
<td>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<asp:TextBox ID="txtMsg" runat="server" Height="60px" Width="247px" CssClass="csstextbox"
TextMode="MultiLine" ></asp:TextBox>
</td>
<td valign="bottom">
<asp:Button ID="btnSend" runat="server" Text="Enviar" OnClick="btnSend_Click" CssClass="botonChat"
Style="display: none" />
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
</td>
</tr>


EL CODIGO DEL BOTON ENVIAR ES ESTE:

if (txtMsg.Text.Trim() != string.Empty)
{
SendMessage(txtMsg.Text);
txtMsg.Text = "";
}

PERO MI PROBLEMA YA SE DONDE ESTA ES PORQUE TENGO MIS CONTROLES DENTRO DE UN UPDATEPANEL, COMO HARIA PARA HACER QUE NO SE DESACTIVE MI TEXTBOX TENIENDO EL UPDATEPANEL, POR FAVOR AYÚDENME ES URGENTE.

MUCHAS GRACIAS DE ANTEMANO.

Etiquetas: js, botones
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta

SíEste tema le ha gustado a 1 personas




La zona horaria es GMT -6. Ahora son las 00:44.