Entradas

Mostrando las entradas etiquetadas como Javascript
OBTENER CONTEXTO (RUTA) function obtenerContexto(){ var contexto; var a = location.pathname.split("/"); if ( a.length > 2 ) { contexto=a[1]; } return contexto; } var ruta = obtenerContexto();
COMPLETAR CON CEROS A LA DERECHA function pad (str, max) {  str = str.toString();  return str.length < max ? pad("0" + str, max) : str; } var f = new Date(); var fecha = pad(f.getDate(), 2) + "/" + pad((f.getMonth() +1), 2) + "/" + f.getFullYear();
REEMPLAZAR CARACTERES CON JAVASCRIPT function replaceAll(text, busca, reemplaza) { if (text === undefined) {    //txt = "x is undefined"; return ""; } else {    //txt = "x is defined"; while (text.toString().indexOf(busca) != -1) text = text.toString().replace(busca,reemplaza); return text; } }