Agencia cube / A-brainstor Posted January 30, 2012 Report Share Posted January 30, 2012 Quote Link to comment Share on other sites More sharing options...
0 ESerra Posted January 30, 2012 Report Share Posted January 30, 2012 Movendo PHP » JS. Quote Link to comment Share on other sites More sharing options...
0 lucas.js Posted January 30, 2012 Report Share Posted January 30, 2012 (edited) Veja se é assim que você quer:HTML:<td id="meu_campo"><input name="nserie" type="text" id="nserie" maxlength="9" /> <input type="button" name="button2" id="button2" value="+" onclick="inserircampo();" /></td> No java script: function inserircampo(){ campo=document.getElementById('nserie'); zeros=campo.value.match(/^0*/)[0]; valor=parseInt(campo.value,10); valor2=valor+1; if((valor+"").length<(valor2+"").length)campo.value=zeros.substr(0,zeros.length-1)+valor2; else campo.value=zeros+valor2; } Edited January 30, 2012 by lucas.js Quote Link to comment Share on other sites More sharing options...
0 Agencia cube / A-brainstor Posted January 31, 2012 Author Report Share Posted January 31, 2012 Veja se é assim que você quer:HTML:<td id="meu_campo"><input name="nserie" type="text" id="nserie" maxlength="9" /> <input type="button" name="button2" id="button2" value="+" onclick="inserircampo();" /></td> No java script: function inserircampo(){ campo=document.getElementById('nserie'); zeros=campo.value.match(/^0*/)[0]; valor=parseInt(campo.value,10); valor2=valor+1; if((valor+"").length<(valor2+"").length)campo.value=zeros.substr(0,zeros.length-1)+valor2; else campo.value=zeros+valor2; }-------------------------------------------------------------------------------------------------Ou Lucas obrigadão por responder primeiramente,a logica é essa mesmo porém há um probleminhaeu quero que ele adicione o valor incrementado de +1 ou seja;Quando eu digitar no campo1 o valor:010203Quero que, ao clicar em "+" e surgir o campo2, apareça:010204e assim sucessivamente para cada vez que eu clicar em "+" Quote Link to comment Share on other sites More sharing options...
0 Agencia cube / A-brainstor Posted February 1, 2012 Author Report Share Posted February 1, 2012 Algúem tem + alguma ideia ai ?HelP Quote Link to comment Share on other sites More sharing options...
0 Agencia cube / A-brainstor Posted February 3, 2012 Author Report Share Posted February 3, 2012 Galeraaa me ajudaaa ai please.. Quote Link to comment Share on other sites More sharing options...
Question
Agencia cube / A-brainstor
Link to comment
Share on other sites
5 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.