Jump to content

Bian

Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by Bian

  1. Yes, sorry, this is the code: cKey = 0; cDots=0; cCipher=0; //function cDots() this is the function idk how to do it { cDots=0; //cDots++; //added } $(document).ready(function(){ //event page full charged $('#txtfecha').keyup(function( event ) { $('#r1').html(event.which.toString()); key = event.which; ans = !(( key >= 48 && key <= 57) || key == 8 || key == 13 || key == 190 ); txtfecha = $('#txtfecha').val(); //save the chain of the textbox if (ans){ $('#r2').html(txtfecha[txtfecha.length-1]); $('#txtfecha').val(txtfecha.substring(0,txtfecha.length-cKey)); alert('It only accepts numbers under 256'); cKey = 0; } //////////////////////////////////// if(txtfecha.length == 3 || txtfecha.length == 7 || txtfecha.length == 11) { $('#txtfecha').val(txtfecha+'.'); } //////////////////////////////////// if(txtfecha.length >= 15){ $('#txtfecha').val(txtfecha.substring(0,15)); } }); $('#txtfecha').keydown(function( event ) { key = event.which; ans = !(( key >= 48 && key <= 57) || key == 8 || key == 13 || key == 190); if (ans){ cKey++; $('#r2').html(cKey.toString()); } }); /*$('#txtfecha').keyup(function( event ) { $('#r2').html(event.which.toString()); }); $('#txtfecha').keypress(function( event ) { $('#r3').html(event.which.toString()); });*/ });
  2. Hello everyone, I need to build a program that validates an ip address in a textbox, but I need a function to locate the position of an dot to see if it is necessary to add a new dot in the chain or not, I would really appreciate it if you can help me, thank you everyone, greetings .
×
×
  • Create New...