Ver Mensaje Individual
  #2 (permalink)  
Antiguo 17/01/2002, 14:40
bet
 
Fecha de Ingreso: febrero-2001
Mensajes: 292
Antigüedad: 23 años, 3 meses
Puntos: 0
Re: Como dar Enter y que haga submit en netscape

No sé si este código es lo mejor, pero funciona...

<pre>
&lt;html&gt;
&lt;head&gt;
&lt;title&gt; New Document &lt;/title&gt;

&lt;script language=&quot;JavaScript&quot;&gt;
&lt;!--
var nav4 = window.Event ? true : false;

function acceptEnter(evt)
{
// NOTE: Enter = 13
var key = nav4 ? evt.which : evt.keyCode;
if (key==13){
document.forms[0].boton.focus();
document.forms[0].submit();
}
}
//--&gt;
&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;form method=post action=&quot;http://www.yahoo.com&quot;&gt;
Nombre &lt;input type=text name=&quot;nombre&quot; size=12&gt; &lt;br&gt;
Pass &lt;input type=text name=&quot;pass&quot; size=12 onKeyPress=&quot;return acceptEnter(event)&quot;&gt;&lt;br&gt;
&lt;input type=&quot;submit&quot; name=&quot;boton&quot;&gt;

&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>

<hr noshade size=1 color="#000000"><img src="http://www.gograph.com/Images-8712/ClipArt/cat03.gif" height="50" border=0 align="absmiddle"> <font size="2" face="verdana" color="#000000">bet[/CODE]