Faccruz 0 Denunciar post Postado Março 17, 2009 Bom dia... Como faço para simular o TAB pelo ENTER? Procurei na internet e achei algumas funções em JAVASCRIPT, mas achei um pouco inviavel, desde que tenho 42 TEXTBOX e 2 BUTTONS, e nos exemplos que achei, é necessário "jogar" o foco em todos componentes. Abaixo um exemplo que eu achei <!-- TWO STEPS TO INSTALL TAB KEY EMULATION: 1. Copy the coding into the HEAD of your HTML document 2. Add the last code into the BODY of your HTML document --> <!-- STEP ONE: Paste this code into the HEAD of your HTML document --> <HEAD> <script LANGUAGE="JavaScript"> <!-- Original: Ronnie T. Moore --> <!-- Web Site: The JavaScript Source --> <!-- This script and many more are available free online at --> <!-- The JavaScript Source!! http://javascript.internet.com --> <!-- Begin nextfield = "box1"; // name of first box on page netscape = ""; ver = navigator.appVersion; len = ver.length; for(iln = 0; iln < len; iln++) if (ver.charAt(iln) == "(") break; netscape = (ver.charAt(iln+1).toUpperCase() != "C"); function keyDown(DnEvents) { // handles keypress // determines whether Netscape or Internet Explorer k = (netscape) ? DnEvents.which : window.event.keyCode; if (k == 13) { // enter key pressed if (nextfield == 'done') return true; // submit, we finished all fields else { // we're not done yet, send focus to next box eval('document.yourform.' + nextfield + '.focus()'); return false; } } } document.onkeydown = keyDown; // work together to analyze keystrokes if (netscape) document.captureEvents(Event.KEYDOWN|Event.KEYUP); // End --> </script> </HEAD> <!-- STEP TWO: Copy this code into the BODY of your HTML document --> <BODY> <center> <form name=yourform> Box 1: <input type=text name=box1 onFocus="nextfield ='box2';"><br> Box 2: <input type=text name=box2 onFocus="nextfield ='box3';"><br> Box 3: <input type=text name=box3 onFocus="nextfield ='box4';"><br> Box 4: <input type=text name=box4 onFocus="nextfield ='done';"><br> <input type=submit name=done value="Submit"> </form> </center> <p><center> <font face="arial, helvetica" size="-2">Free JavaScripts provided<br> by <a href="http://javascriptsource.com">The JavaScript Source</a></font> </center><p> <!-- Script Size: 1.78 KB --> Tem algum jeito mais facil? Como o TABORDER em Delphi? Compartilhar este post Link para o post Compartilhar em outros sites
quintelab 91 Denunciar post Postado Março 17, 2009 Algo pronto não terá, os controles tem o TabIndex mas o TAB foi respeita esse TabIndex. Se encontrar algum método em c# ou vb pode fazer algo que percorra todo seu formulário para adicionar algum evento. Abraços... Compartilhar este post Link para o post Compartilhar em outros sites