Fóruns sobre PHP, JavaScript, HTML, MySQLi, jQuery, Banco de Dados, CSS


Moderador: web

 
Mais de 10 postagens
Mais de 10 postagens
Tópico Autor
Mensagens: 14

ajuda em autocomplete textbox

08-02-2011 12:23

ola pessoal...tenho essa pagina de cadastro de estoque onde adicionei um auto complete para facilitar na hora do cadastro do produto, o problema eh que ele so esta funcionando na 1ª textbox alguem poderia me ajudar a implementar ela nas outras???

obs.: dependendo da quantidade voce adiciona mais inputs textbox com javascript...isso apartir da 2ª linha de cadastro...a 1ª eh um input normal.
vejam o codigo abaixo....

<html> <head> <title>Adicionar Toras</title> <link rel="stylesheet" href="AutoComplete.css" media="screen" type="text/css"> <script language="javascript" type="text/javascript" src="AutoComplete.js"></script> <style type="text/css"> #menuhorizontal { border:none; margin: 0; font: 10px Arial, sans-serif; } #menuhorizontal li { list-style: none; margin: 0; display: inline; } #menuhorizontal li a { height:1px; /* IE5.0 bug */ padding: 3px 10px; margin:0; border: 1px solid #000000; background: #666666; /* #e1eafe */ text-decoration: none; } #menuhorizontal li a:link { color: #FFFFFF; /* #96b4f6 */ } #menuhorizontal li a:visited { color: #fff; /* #fff */ } #menuhorizontal li a:hover { background:#666666; /* #ffeecd */ color:#FFFFFF; /* #eebc5b */ border-color:#999999; /* #f8d694 */ } </style>  <style type="text/css"> #menuhorizontal2 { border:none; margin-top: 2px; margin-left: 52px; font: 10px Arial, sans-serif; } #menuhorizontal2 li { list-style: none; margin: 0; display: inline; } #menuhorizontal2 li a { height:1px; /* IE5.0 bug */ padding: 3px 10px; margin:0; border: 1px solid #000000; background: #CCCCCC; /* #e1eafe */ text-decoration: none; } #menuhorizontal2 li a:link { color: #000000; /* #96b4f6 */ } #menuhorizontal2 li a:visited { color: #000000; /* #fff */ } #menuhorizontal2 li a:hover { background:#CCCCCC; /* #ffeecd */ color:#000000; /* #eebc5b */ border-color:#999999; /* #f8d694 */ }  </style> <style type="text/css"> body {         background-color:#EEEEEE;         margin-left: 0px;         margin-top: 0px;         margin-right: 0px;         margin-bottom: 0px; } .style2 {         font-size: 36px;         font-weight: bold;         font-family: Geneva, Arial, Helvetica, sans-serif; } .style5 {font-size: 18px} </style>   <SCRIPT LANGUAGE="javascript"> function afixar(form) { var testin =document. form.input.value; document.form.output.value=testin } </SCRIPT>   <script language="javascript"> fields = 1; function addInput() { if (fields != 1000) { fields += 1; document.getElementById('text').innerHTML += "<input name='quant[]' type='text' style='text-align:center' value='"+fields+"' size='1' disabled/> <input name='numero[]' type='text' style='text-align:center' onKeyUp='metragem(this);'  onKeyUp='metragem(this)' onKeyDown='if(event.keyCode==39) event.keyCode=9;' value='' size='5'maxlength='6' /> <input name='especie[]' onKeyDown='if(event.keyCode==39) event.keyCode=9;' type='text' value='' id=tora size='26' /> <input name='diametro[]' type='text' style='text-align:center' onkeyup='metragem(this);' onKeyUp='metragem(this)' onKeyDown='if(event.keyCode==39) event.keyCode=9;' value='' size='4' maxlength='3' /> <input name='comprimento[]' type='text' style='text-align:center' onkeyup='metragem2(this);' onKeyUp='metragem(this)' onKeyDown='if(event.keyCode==39) event.keyCode=9;' value='' size='4' maxlength='4' /> <input name='diamibama[]' type='text' style='text-align:center' onkeyup='metragem(this);' onKeyUp='metragem(this)' onKeyDown='if(event.keyCode==39) event.keyCode=9;' value='' size='4' maxlength='3' /> <input name='compibama[]' type='text' style='text-align:center' onkeyup='metragem3(this);' onKeyUp='metragem(this)' onKeyDown='if(event.keyCode==39) event.keyCode=9;' value='' size='4' maxlength='5' /> <input name='dinheiro[]' type='text' style='text-align:right' onkeyup='moeda(this);' onKeyUp='metragem(this)' onKeyDown='if(event.keyCode==39) event.keyCode=9;' value='' size='5' maxlength='6' /><br />"; } else { document.getElementById('text').innerHTML += "<br />Registro maximo de 10 Animais!"; document.form.add.disabled=true; } }   function VerificaSenha(form) {   login = form.motorista.value; d = document.form;   if (login == "") { alert ("\O Motorista deve ser Informado!"); d.motorista.focus(); return false; }     if (codverifica != num1) { window.location.reload(); alert ("\O Codigo de Verificação está incorreto!"); return false; } else return true; }       function metragem(z){         v = z.value;         v=v.replace(/\D/g,"")  //permite digitar apenas números         z.value = v;     }             function metragem2(z){         v = z.value;         v=v.replace(/\D/g,"")  //permite digitar apenas números     v=v.replace(/[0-9]{12}/,"inválido")   //limita pra máximo 999.999.999,99     v=v.replace(/(\d{1})(\d{1})$/,"$1.$2")  //coloca ponto antes dos últimos 5 digitos         z.value = v;     }                     function metragem3(z){         v = z.value;         v=v.replace(/\D/g,"")  //permite digitar apenas números     v=v.replace(/[0-9]{12}/,"inválido")   //limita pra máximo 999.999.999,99     v=v.replace(/(\d{1})(\d{2})$/,"$1.$2")  //coloca ponto antes dos últimos 5 digitos         z.value = v;     }             function moeda(z){           v = z.value; v=v.replace(/\D/g,"")  //permite digitar apenas números   v=v.replace(/[0-9]{8}/,"inválido")   //limita pra máximo 999.999.999,99   v=v.replace(/(\d{1})(\d{8})$/,"$1.$2")  //coloca ponto antes dos últimos 8 digitos   v=v.replace(/(\d{1})(\d{5})$/,"$1.$2")  //coloca ponto antes dos últimos 5 digitos   v=v.replace(/(\d{1})(\d{1,2})$/,"$1,$2")    //coloca virgula antes dos últimos 2 digitos                 z.value = v;     } //--> </script> </head>   <body> <p align="center"><span class="style2">Controle de Estoque<br /> </span><strong><span class="style5">Adicionar Toras</span></strong></p> <table width="500" border="0" align="center" cellpadding="0" cellspacing="0">   <tr>     <td><table width="580" border="1" cellpadding="0" cellspacing="0">       <tr bgcolor="#999999">                 <td width="66%"><table width="580" border="1" cellpadding="0" cellspacing="0">           <tr>             <td width="42" title="Valor do m&sup3;"><div align="center"><strong>Und</strong></div></td>             <td width="59"><div align="center"><strong>N&ordm;</strong></div></td>             <td width="182"><div align="center"><strong>Esp&eacute;cie</strong></div></td>             <td width="55"><div align="center"><strong>Diam</strong></div></td>             <td width="54"><div align="center"><strong>Com</strong></div></td>             <td width="55" title="Diametro Medida do IBAMA"><div align="center"><strong>Diam I. </strong></div></td>             <td width="54" title="Comprimento Medida do IBAMA"><div align="center"><strong>Com I. </strong></div></td>             <td width="61" title="Valor do m&sup3;"><div align="center"><strong>R$</strong></div></td>           </tr>         </table></td>       </tr>       <tr>                 <td>                   <div align="center">         <form name="form" method="post" onSubmit="return VerificaSenha(this)" > >         <input name='quant[]' type='text' style='text-align:center' value='1' size='1' disabled />         <input name='numero[]' type='text' style="text-align:center" onKeyUp="metragem(this)" onKeyDown="if(event.keyCode==39) event.keyCode=9;" value='' size="5" maxlength="6" />     <input name='especie[]' type='text' id="tora" onKeyDown="if(event.keyCode==39) event.keyCode=9;" value='' size="26" />     <input name='diametro[]' type='text' style="text-align:center" onKeyUp="metragem(this);" onKeyDown="if(event.keyCode==39) event.keyCode=9;" value='' size="4" maxlength="3" />     <input name='comprimento[]' type='text' style="text-align:center" onKeyUp="metragem2(this);" onKeyDown="if(event.keyCode==39) event.keyCode=9;" value='' size="4" maxlength="4" />     <input name='diamibama[]' type='text' style="text-align:center" onKeyUp="metragem(this);" onKeyDown="if(event.keyCode==39) event.keyCode=9;" value='' size="4" maxlength="3" />     <input name='compibama[]' type='text' style="text-align:center" onKeyUp="metragem3(this);" onKeyDown="if(event.keyCode==39) event.keyCode=9;" value='' size="4" maxlength="5" />     <input name='dinheiro[]' type='text' style="text-align:right" onKeyUp="moeda(this);" onKeyDown="if(event.keyCode==39) event.keyCode=9;" value='' size="5" maxlength="6" />     <br />         <div id="text"></div>         </div>    </td>         </tr>       <tr bgcolor="#999999">                 <td><table width="100%" border="0" cellspacing="0" cellpadding="0">             <tr>               <td width="50%">&nbsp;                 <input name="BUTTON2" type="button" onClick="window.location.href='http://localhost/controle'" value="Voltar" /> <input type="button" onClick="addInput()" name="add" value="+ Toras" /> <input name="limpa" type="reset" id="limpa" value="Limpar" />                 <input name="envia" type="submit" id="envia" onClick="return confirm('Adicionar Essas Toras?')" value="Enviar" /></td>               <td width="50%"><div align="right"><strong>Motorista:</strong>                     <input name='motorista' type='text' id="motorista" size="10" maxlength="10" />&nbsp;               </div></td>             </tr>           </table>                                                    </td>                 </tr> </table>     </td>   </tr> </table> </body> </html> <script language="javascript" type="text/javascript"> data =['jequitiba','ipe','pequi','amapa','catuaba','breu','massaranduba','embireira','garapa','faveiro ferro','angelim pedra'].sort(); AutoComplete_Create('tora', data, 6);   // --> </script>

JUNTO O ARQUIVO AutoComplete.css
.autocomplete {     font-family: Tahoma;     font-size: 8pt;     background-color: white;     border: 1px solid black;     position: absolute;     cursor: default;     overflow: auto;     overflow-x: hidden; }   .autocomplete_item {     padding: 1px;     padding-left: 5px;     color: black;     width: 100%; }   .autocomplete_item_highlighted {     padding: 1px;     padding-left: 5px;     color: white;     background-color: #0A246A; }

E O AutoComplete.js

/** * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA * * © Copyright 2005 Richard Heyes */       /**     * Global vars     */     __AutoComplete = new Array();       // Basic UA detection     isIE = document.all ? true : false;     isGecko = navigator.userAgent.toLowerCase().indexOf('gecko') != -1;     isOpera = navigator.userAgent.toLowerCase().indexOf('opera') != -1;         /**     * Attachs the autocomplete object to a form element. Sets     * onkeypress event on the form element.     *     * @param string formElement Name of form element to attach to     * @param array  data        Array of strings of which to use as the autocomplete data     */     function AutoComplete_Create (id, data)     {         __AutoComplete[id] = {'data':data,                               'isVisible':false,                               'element':document.getElementById(id),                               'dropdown':null,                               'highlighted':null};           __AutoComplete[id]['element'].setAttribute('autocomplete', 'off');         __AutoComplete[id]['element'].onkeydown  = function(e) {return AutoComplete_KeyDown(this.getAttribute('id'), e);}         __AutoComplete[id]['element'].onkeyup    = function(e) {return AutoComplete_KeyUp(this.getAttribute('id'), e);}         __AutoComplete[id]['element'].onkeypress = function(e) {if (!e) e = window.event; if (e.keyCode == 13 || isOpera) return false;}         __AutoComplete[id]['element'].ondblclick = function() {AutoComplete_ShowDropdown(this.getAttribute('id'));}         __AutoComplete[id]['element'].onclick    = function(e) {if (!e) e = window.event; e.cancelBubble = true; e.returnValue = false;}           // Hides the dropdowns when document clicked         var docClick = function()         {            for (id in __AutoComplete) {                AutoComplete_HideDropdown(id);            }         }           if (document.addEventListener) {             document.addEventListener('click', docClick, false);         } else if (document.attachEvent) {             document.attachEvent('onclick', docClick, false);         }             // Max number of items shown at once         if (arguments[2] != null) {             __AutoComplete[id]['maxitems'] = arguments[2];             __AutoComplete[id]['firstItemShowing'] = 0;             __AutoComplete[id]['lastItemShowing']  = arguments[2] - 1;         }                 AutoComplete_CreateDropdown(id);                 // Prevent select dropdowns showing thru         if (isIE) {             __AutoComplete[id]['iframe'] = document.createElement('iframe');             __AutoComplete[id]['iframe'].id = id +'_iframe';             __AutoComplete[id]['iframe'].style.position = 'absolute';             __AutoComplete[id]['iframe'].style.top = '0';             __AutoComplete[id]['iframe'].style.left = '0';             __AutoComplete[id]['iframe'].style.width = '0px';             __AutoComplete[id]['iframe'].style.height = '0px';             __AutoComplete[id]['iframe'].style.zIndex = '98';             __AutoComplete[id]['iframe'].style.visibility = 'hidden';                         __AutoComplete[id]['element'].parentNode.insertBefore(__AutoComplete[id]['iframe'], __AutoComplete[id]['element']);         }     }         /**     * Creates the dropdown layer     *     * @param string id The form elements id. Used to identify the correct dropdown.     */     function AutoComplete_CreateDropdown(id)     {         var left  = AutoComplete_GetLeft(__AutoComplete[id]['element']);         var top   = AutoComplete_GetTop(__AutoComplete[id]['element']) + __AutoComplete[id]['element'].offsetHeight;         var width = __AutoComplete[id]['element'].offsetWidth;             __AutoComplete[id]['dropdown'] = document.createElement('div');         __AutoComplete[id]['dropdown'].className = 'autocomplete'; // Don't use setAttribute()             __AutoComplete[id]['element'].parentNode.insertBefore(__AutoComplete[id]['dropdown'], __AutoComplete[id]['element']);                 // Position it         __AutoComplete[id]['dropdown'].style.left       = left + 'px';         __AutoComplete[id]['dropdown'].style.top        = top + 'px';         __AutoComplete[id]['dropdown'].style.width      = width + 'px';         __AutoComplete[id]['dropdown'].style.zIndex     = '99';         __AutoComplete[id]['dropdown'].style.visibility = 'hidden';     }             /**     * Gets left coord of given element     *     * @param object element The element to get the left coord for     */     function AutoComplete_GetLeft(element)     {         var curNode = element;         var left    = 0;           do {             left += curNode.offsetLeft;             curNode = curNode.offsetParent;           } while(curNode.tagName.toLowerCase() != 'body');           return left;     }             /**     * Gets top coord of given element     *     * @param object element The element to get the top coord for     */     function AutoComplete_GetTop(element)     {         var curNode = element;         var top    = 0;           do {             top += curNode.offsetTop;             curNode = curNode.offsetParent;           } while(curNode.tagName.toLowerCase() != 'body');           return top;     }           /**     * Shows the dropdown layer     *     * @param string id The form elements id. Used to identify the correct dropdown.     */     function AutoComplete_ShowDropdown(id)     {         AutoComplete_HideAll();           var value = __AutoComplete[id]['element'].value;         var toDisplay = new Array();         var newDiv    = null;         var text      = null;         var numItems  = __AutoComplete[id]['dropdown'].childNodes.length;           // Remove all child nodes from dropdown         while (__AutoComplete[id]['dropdown'].childNodes.length > 0) {             __AutoComplete[id]['dropdown'].removeChild(__AutoComplete[id]['dropdown'].childNodes[0]);         }           // Go thru data searching for matches         for (i=0; i<__AutoComplete[id]['data'].length; ++i) {             if (__AutoComplete[id]['data'][i].substr(0, value.length) == value) {                 toDisplay[toDisplay.length] = __AutoComplete[id]['data'][i];             }         }                 // No matches?         if (toDisplay.length == 0) {             AutoComplete_HideDropdown(id);             return;         }               // Add data to the dropdown layer         for (i=0; i<toDisplay.length; ++i) {             newDiv = document.createElement('div');             newDiv.className = 'autocomplete_item'; // Don't use setAttribute()             newDiv.setAttribute('id', 'autocomplete_item_' + i);             newDiv.setAttribute('index', i);             newDiv.style.zIndex = '99';                          // Scrollbars are on display ?             if (toDisplay.length > __AutoComplete[id]['maxitems'] && navigator.userAgent.indexOf('MSIE') == -1) {                 newDiv.style.width = __AutoComplete[id]['element'].offsetWidth - 22 + 'px';             }               newDiv.onmouseover = function() {AutoComplete_HighlightItem(__AutoComplete[id]['element'].getAttribute('id'), this.getAttribute('index'));};             newDiv.onclick     = function() {AutoComplete_SetValue(__AutoComplete[id]['element'].getAttribute('id')); AutoComplete_HideDropdown(__AutoComplete[id]['element'].getAttribute('id'));}                         text   = document.createTextNode(toDisplay[i]);             newDiv.appendChild(text);                         __AutoComplete[id]['dropdown'].appendChild(newDiv);         }                         // Too many items?         if (toDisplay.length > __AutoComplete[id]['maxitems']) {             __AutoComplete[id]['dropdown'].style.height = (__AutoComplete[id]['maxitems'] * 15) + 2 + 'px';                 } else {             __AutoComplete[id]['dropdown'].style.height = '';         }                   /**         * Set left/top in case of document movement/scroll/window resize etc         */         __AutoComplete[id]['dropdown'].style.left = AutoComplete_GetLeft(__AutoComplete[id]['element']);         __AutoComplete[id]['dropdown'].style.top  = AutoComplete_GetTop(__AutoComplete[id]['element']) + __AutoComplete[id]['element'].offsetHeight;             // Show the iframe for IE         if (isIE) {             __AutoComplete[id]['iframe'].style.top    = __AutoComplete[id]['dropdown'].style.top;             __AutoComplete[id]['iframe'].style.left   = __AutoComplete[id]['dropdown'].style.left;             __AutoComplete[id]['iframe'].style.width  = __AutoComplete[id]['dropdown'].offsetWidth;             __AutoComplete[id]['iframe'].style.height = __AutoComplete[id]['dropdown'].offsetHeight;                         __AutoComplete[id]['iframe'].style.visibility = 'visible';         }             // Show dropdown         if (!__AutoComplete[id]['isVisible']) {             __AutoComplete[id]['dropdown'].style.visibility = 'visible';             __AutoComplete[id]['isVisible'] = true;         }                   // If now showing less items than before, reset the highlighted value         if (__AutoComplete[id]['dropdown'].childNodes.length != numItems) {             __AutoComplete[id]['highlighted'] = null;         }     }             /**     * Hides the dropdown layer     *     * @param string id The form elements id. Used to identify the correct dropdown.     */     function AutoComplete_HideDropdown(id)     {         if (__AutoComplete[id]['iframe']) {             __AutoComplete[id]['iframe'].style.visibility = 'hidden';         }             __AutoComplete[id]['dropdown'].style.visibility = 'hidden';         __AutoComplete[id]['highlighted'] = null;         __AutoComplete[id]['isVisible']   = false;     }             /**     * Hides all dropdowns     */     function AutoComplete_HideAll()     {         for (id in __AutoComplete) {             AutoComplete_HideDropdown(id);         }     }             /**     * Highlights a specific item     *     * @param string id    The form elements id. Used to identify the correct dropdown.     * @param int    index The index of the element in the dropdown to highlight     */     function AutoComplete_HighlightItem(id, index)     {         if (__AutoComplete[id]['dropdown'].childNodes[index]) {             for (var i=0; i<__AutoComplete[id]['dropdown'].childNodes.length; ++i) {                 if (__AutoComplete[id]['dropdown'].childNodes[i].className == 'autocomplete_item_highlighted') {                     __AutoComplete[id]['dropdown'].childNodes[i].className = 'autocomplete_item';                 }             }                         __AutoComplete[id]['dropdown'].childNodes[index].className = 'autocomplete_item_highlighted';             __AutoComplete[id]['highlighted'] = index;         }     }         /**     * Highlights the menu item with the given index     *     * @param string id    The form elements id. Used to identify the correct dropdown.     * @param int    index The index of the element in the dropdown to highlight     */     function AutoComplete_Highlight(id, index)     {         // Out of bounds checking         if (index == 1 && __AutoComplete[id]['highlighted'] == __AutoComplete[id]['dropdown'].childNodes.length - 1) {             __AutoComplete[id]['dropdown'].childNodes[__AutoComplete[id]['highlighted']].className = 'autocomplete_item';             __AutoComplete[id]['highlighted'] = null;                 } else if (index == -1 && __AutoComplete[id]['highlighted'] == 0) {             __AutoComplete[id]['dropdown'].childNodes[0].className = 'autocomplete_item';             __AutoComplete[id]['highlighted'] = __AutoComplete[id]['dropdown'].childNodes.length;         }           // Nothing highlighted at the moment         if (__AutoComplete[id]['highlighted'] == null) {             __AutoComplete[id]['dropdown'].childNodes[0].className = 'autocomplete_item_highlighted';             __AutoComplete[id]['highlighted'] = 0;           } else {             if (__AutoComplete[id]['dropdown'].childNodes[__AutoComplete[id]['highlighted']]) {                 __AutoComplete[id]['dropdown'].childNodes[__AutoComplete[id]['highlighted']].className = 'autocomplete_item';             }               var newIndex = __AutoComplete[id]['highlighted'] + index;               if (__AutoComplete[id]['dropdown'].childNodes[newIndex]) {                 __AutoComplete[id]['dropdown'].childNodes[newIndex].className = 'autocomplete_item_highlighted';                                 __AutoComplete[id]['highlighted'] = newIndex;             }         }     }         /**     * Sets the input to a given value     *     * @param string id    The form elements id. Used to identify the correct dropdown.     */     function AutoComplete_SetValue(id)     {         __AutoComplete[id]['element'].value = __AutoComplete[id]['dropdown'].childNodes[__AutoComplete[id]['highlighted']].innerHTML;     }             /**     * Checks if the dropdown needs scrolling     *     * @param string id    The form elements id. Used to identify the correct dropdown.     */     function AutoComplete_ScrollCheck(id)     {         // Scroll down, or wrapping around from scroll up         if (__AutoComplete[id]['highlighted'] > __AutoComplete[id]['lastItemShowing']) {             __AutoComplete[id]['firstItemShowing'] = __AutoComplete[id]['highlighted'] - (__AutoComplete[id]['maxitems'] - 1);             __AutoComplete[id]['lastItemShowing']  = __AutoComplete[id]['highlighted'];         }                 // Scroll up, or wrapping around from scroll down         if (__AutoComplete[id]['highlighted'] < __AutoComplete[id]['firstItemShowing']) {             __AutoComplete[id]['firstItemShowing'] = __AutoComplete[id]['highlighted'];             __AutoComplete[id]['lastItemShowing']  = __AutoComplete[id]['highlighted'] + (__AutoComplete[id]['maxitems'] - 1);         }                 __AutoComplete[id]['dropdown'].scrollTop = __AutoComplete[id]['firstItemShowing'] * 15;     }         /**     * Function which handles the keypress event     *     * @param string id    The form elements id. Used to identify the correct dropdown.     */     function AutoComplete_KeyDown(id)     {         // Mozilla         if (arguments[1] != null) {             event = arguments[1];         }           var keyCode = event.keyCode;           switch (keyCode) {               // Return/Enter             case 13:                 if (__AutoComplete[id]['highlighted'] != null) {                     AutoComplete_SetValue(id);                     AutoComplete_HideDropdown(id);                 }                                 event.returnValue = false;                 event.cancelBubble = true;                 break;               // Escape             case 27:                 AutoComplete_HideDropdown(id);                 event.returnValue = false;                 event.cancelBubble = true;                 break;                         // Up arrow             case 38:                 if (!__AutoComplete[id]['isVisible']) {                     AutoComplete_ShowDropdown(id);                 }                                 AutoComplete_Highlight(id, -1);                 AutoComplete_ScrollCheck(id, -1);                 return false;                 break;                         // Tab             case 9:                 if (__AutoComplete[id]['isVisible']) {                     AutoComplete_HideDropdown(id);                 }                 return;                         // Down arrow             case 40:                 if (!__AutoComplete[id]['isVisible']) {                     AutoComplete_ShowDropdown(id);                 }                                 AutoComplete_Highlight(id, 1);                 AutoComplete_ScrollCheck(id, 1);                 return false;                 break;         }     }         /**     * Function which handles the keyup event     *     * @param string id    The form elements id. Used to identify the correct dropdown.     */     function AutoComplete_KeyUp(id)     {         // Mozilla         if (arguments[1] != null) {             event = arguments[1];         }           var keyCode = event.keyCode;           switch (keyCode) {             case 13:                 event.returnValue = false;                 event.cancelBubble = true;                 break;               case 27:                 AutoComplete_HideDropdown(id);                 event.returnValue = false;                 event.cancelBubble = true;                 break;                         case 38:             case 40:                 return false;                 break;               default:                 AutoComplete_ShowDropdown(id);                 break;         }     }         /**     * Returns whether the dropdown is visible     *     * @param string id    The form elements id. Used to identify the correct dropdown.     */     function AutoComplete_isVisible(id)     {         return __AutoComplete[id]['dropdown'].style.visibility == 'visible';     }

AGRADECO DES DE JA VLW
0
 
Avatar do usuário
ADMIN
ADMIN
Mensagens: 17521
Nome: Kleber
Descrição do site: Onde você encontra scripts grátis para o seu site
Sexo: Masculino
Localização: RJ / RJ / Brasil
Contato:

ajuda em autocomplete textbox

08-02-2011 14:14

Testei seu script aqui, e ao clicar em "+ Toras" ele adiciona os inputs sem problema. Testei no Firefox
0
A melhor hospedagem para o seu site HostGator!
 
Mais de 10 postagens
Mais de 10 postagens
Tópico Autor
Mensagens: 14

ajuda em autocomplete textbox

08-02-2011 17:59

sim mano ele adiciona, mais o problema é no auto complete.. tipow so a 1ª linha esta funcionando coloque a letra "a" na primeira textbox de essencia e ira aparecer "azul, amarelo" como "sugestao"... e na segunda nao funciona....
0
Editado pela última vez por web em 08-02-2011 18:03, em um total de 1 vez.
Razão: NÃO USAR CAPS LOCK NO TÍTULO OU MENSAGEM
 
Avatar do usuário
ADMIN
ADMIN
Mensagens: 17521
Nome: Kleber
Descrição do site: Onde você encontra scripts grátis para o seu site
Sexo: Masculino
Localização: RJ / RJ / Brasil
Contato:

ajuda em autocomplete textbox

08-02-2011 18:07

Nesse input tem um onkeyup, que carrega o autocomplete, seria só você adicionar ele na parte do script que vai criar os novos inputs
0
A melhor hospedagem para o seu site HostGator!
 
Mais de 10 postagens
Mais de 10 postagens
Tópico Autor
Mensagens: 14

ajuda em autocomplete textbox

09-02-2011 09:24

web, nao entendi oq voce falou mais olha, na input que funciona esta assim...

<input name='especie[]' type='text' id="tora" onKeyDown="if(event.keyCode==39) event.keyCode=9;" value='' size="26" />

e na input que o javascript cria eh assim...

<input name='especie[]' type='text' id='tora' onKeyDown='if(event.keyCode==39) event.keyCode=9;' value='' size='26' />

eh exatamente a mesma input...pq nao funciona nas inputs que o java cria??
0
 
Mais de 10 postagens
Mais de 10 postagens
Tópico Autor
Mensagens: 14

ajuda em autocomplete textbox

09-02-2011 09:44

oh cara desculpa..o problema é que o auto complete nao funciona em todas as imputs com a mesma id e sim somente na primeira.. :S
0
 
Mais de 10 postagens
Mais de 10 postagens
Tópico Autor
Mensagens: 14

ajuda em autocomplete textbox

09-02-2011 10:56

PROBLEMA RESOLVIDO...DESCULPE O TRANSTORNO
0

Quem está online

Usuários navegando neste fórum: Nenhum usuário registrado