Jump to content
Fórum Script Brasil
  • 0

Ajuda - ENTER com ONKEYPRESS


daeyure

Question

Olá pessoal,

Mais uma vez retorno à esse fórum que sempre me ajuda....

Estou com um problema na hora de fazer login para meu site.

Fiz duas forms para senha e username e um botão para login.

O problema é que para fazer o login é necessário clicar no botão....mas eu também quero que seja possível apenas apertar ENTER para enviar os forms.

Ou seja, além de opção de clicar no botão de login, também queria que uma vez pressionada a tecla ENTER os forms fossem submetidos.

Segue abaixo o meu código que eu não sei porque não funciona.

Abraços galera....

Se alguém puder me ajudar, seria "bão demais da conta"...rs

Vlw...

<script>

function TrocaValorCliNome()
                                {
                                    if(document.getElementById('EmailCli').value=='EMAIL')
                                    {
                                        document.getElementById('EmailCli').value = ''
                                    }
                                    else
                                    {
                                        if(document.getElementById('EmailCli').value=='')
                                        {                                        
                                            document.getElementById('EmailCli').value = 'EMAIL'                                        
                                        }
                                    }
                                }
                                
                                function TrocaValorCliSenha()
                                {
                                    if(document.getElementById('SenhaCli').value=='Senha')
                                    {
                                        document.getElementById('SenhaCli').value = ''
                                    }
                                    else
                                    {
                                        if(document.getElementById('SenhaCli').value=='')
                                        {                                        
                                            document.getElementById('SenhaCli').value = 'Senha'                                        
                                        }
                                    }
                                }                                
                                
                                function AbreCliLogin()
                                {
                                    document.getElementById('formcli1').submit()
                                }                            
                                var VStr = "##AreaClientes##"
                                if(VStr == "")
                                
                                {             
                                
                                    document.write('<center><p><form id="formcli1" name="formcli1" action="##CaminhoDir##Default.asp?Menu=Cadastro&Param=Ins&Act=Cadastrar&OP=1&PGRetorno=PaginaInicial" method="post"><td width="1%" nowrap="nowrap"  style="padding-bottom:7px; padding-left:0px;"><input name="EmailCli" type="text" id="EmailCli" onfocus="TrocaValorCliNome()" onblur="TrocaValorCliNome()" style="background-color:#faf9f7; border:solid 1px #d4c6b9; width:140px; font-family:arial; font-size:11px; color:#7c6e5e" value="EMAIL"/><p><span style="padding-left:0px"><input name="SenhaCli" type="password" id="SenhaCli" onfocus="TrocaValorCliSenha()" onblur="TrocaValorCliSenha()" style="background-color:#faf9f7; border:solid 1px #d4c6b9; width:140px; font-family:arial; font-size:11px; color:#7c6e5e" value="Senha"/></span></td><td height="45"><p><br><img src="imagens/bt_logar.png" id= "btlogin" style="padding-bottom:8px; cursor:pointer" onclick="AbreCliLogin()"; onKeyPress="{if (event.keyCode==13)AbreCliLogin()}"/></center></td></form>            ')
                                }
                                else
                                {
                                    document.write('<center><td style="padding-left:30px; padding-bottom:5px;"  nowrap="nowrap" width="1%">##ClienteNome##<p><a href="##CaminhoDir##Default.asp?Menu=Cadastro&Act=Cadastrar">Alteração de cadastro</a><br><a href="##CaminhoDir##Default.asp?Menu=PedidosBusca">Meus pedidos</a><p><a href="##CaminhoDir##Default.asp?Menu=Sair"><img src="imagens/bt_sair.png"></a></td></center>')
                                }
                            </script>

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...