<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Generar CURP</title> <script language="javascript" src="utils.js" type="text/javascript"></script> <script language="javascript" src="curp.js" type="text/javascript"></script> <script language="javascript" src="identificar.js" type="text/javascript"></script> <script language="javascript" src="validarcurp.js" type="text/javascript"></script> <style> #resultado { background-color: red; color: white; font-weight: bold; } #resultado.ok { background-color: green; } </style> <script> //Función para validar una CURP function curpValida(curp) { var re = /^([A-Z][AEIOUX][A-Z]{2}\d{2}(?:0[1-9]|1[0-2])(?:0[1-9]|[12]\d|3[01])[HM](?:AS|B[CS]|C[CLMSH]|D[FG]|G[TR]|HG|JC|M[CNS]|N[ETL]|OC|PL|Q[TR]|S[PLR]|T[CSL]|VZ|YN|ZS)[B-DF-HJ-NP-TV-Z]{3}[A-Z\d])(\d)$/, validado = curp.match(re); if (!validado) //Coincide con el formato general? return false; //Validar que coincida el dígito verificador function digitoVerificador(curp17) { //Fuente https://consultas.curp.gob.mx/CurpSP/ var diccionario = "0123456789ABCDEFGHIJKLMNÑOPQRSTUVWXYZ", lngSuma = 0.0, lngDigito = 0.0; for(var i=0; i<17; i++) lngSuma = lngSuma + diccionario.indexOf(curp17.charAt(i)) * (18 - i); lngDigito = 10 - lngSuma % 10; if (lngDigito == 10) return 0; return lngDigito; } if (validado[2] != digitoVerificador(validado[1])) return false; return true; //Validado } //Handler para el evento cuando cambia el input //Lleva la CURP a mayúsculas para validarlo function validarInput(input) { var curp = input.value.toUpperCase(), resultado = document.getElementById("resultado"), valido = "No válido"; if (curpValida(curp)) { // ?? Acá se comprueba valido = "Válido" resultado.classList.add("ok"); } else { resultado.classList.remove("ok"); } resultado.innerText = "CURP: " + curp + "\nFormato: " + valido; } </script> </head> <body> <font face="Arial"> <form name="frm" method="post" id="frm"> <p> Nombre: <input name="whNombre" id="whNombre" value="" type="text"> </p> <p> Apellido paterno: <input name="whPaterno" id="whPaterno" value="" type="text" size="14"> </p> <p> Apellido materno: <input name="whMaterno" id="whMaterno" value="" type="text" size="14"> </p> <p> Fecha de nacimiento: <input value="" name="whFecNac" id="whFecNac" type="text" placeholder="dd/mm/aaaa" size="10"> </p> <p> Género: <select name="whGenero" id="whGenero"> <option value="x"> -Elige- </option> <option value="F"> FEMENINO </option> <option value="M"> MASCULINO </option> </select> </p> <p> Nacionalidad: <select name="whNacion" id="whNacion"> <option value="1">MÉXICO</option> <option value="2">AFGANISTAN</option> <option value="3">ALBANIA</option> <option value="4">ALEMANIA</option> <option value="5">ANDORRA</option> <option value="6">ANGOLA</option> <option value="180">ANGUILA</option> <option value="181">ANTÁRTICA</option> <option value="7">ANTIGUA Y BARBUDA</option> <option value="182">ANTILLAS NEERLANDESAS</option> <option value="8">ARABES UNIDOS(EMIRATOS)</option> <option value="9">ARABIA SAUDITA</option> <option value="10">ARGELIA</option> <option value="11">ARGENTINA</option> <option value="12">ARMENIA</option> <option value="183">ARUBA</option> <option value="13">AUSTRALIA</option> <option value="14">AUSTRIA</option> <option value="15">AZERBAIYAN</option> <option value="16">BAHAMAS</option> <option value="17">BAHREIN</option> <option value="18">BANGLADESH</option> <option value="19">BARBADOS</option> <option value="184">BELARUS</option> <option value="20">BÉLGICA</option> <option value="21">BELICE</option> <option value="22">BENIN</option> <option value="185">BERMUDA</option> <option value="186">BHUTAN</option> <option value="23">BIELORRUSIA</option> <option value="24">BIRMANIA</option> <option value="25">BOLIVIA</option> <option value="26">BOSNIA Y HERZEGOVINA</option> <option value="27">BOTSWANA</option> <option value="28">BRAZIL</option> <option value="29">BRUNEI DARUSSALAM</option> <option value="30">BULGARIA</option> <option value="31">BURKINA FASO</option> <option value="32">BURUNDI</option> <option value="33">BUTAN</option> <option value="34">CABO VERDE</option> <option value="35">CAMBOYA</option> <option value="36">CAMERÚN</option> <option value="37">CANADÁ</option> <option value="47">CHAD</option> <option value="48">CHECA</option> <option value="49">CHILE</option> <option value="50">CHINA</option> <option value="51">CHIPRE</option> <option value="38">COLOMBIA</option> <option value="39">COMORAS</option> <option value="40">CONGO</option> <option value="41">COREA DEL NORTE</option> <option value="42">COREA DEL SUR</option> <option value="44">COSTA DE MARFIL</option> <option value="43">COSTA RICA</option> <option value="167">CRANIA</option> <option value="45">CROACIA</option> <option value="46">CUBA</option> <option value="52">DINAMARCA</option> <option value="187">DJIBOUTI</option> <option value="53">DOMINICA</option> <option value="54">DOMINICANA (REPUBLICANA)</option> <option value="55">ECUADOR</option> <option value="56">EGIPTO</option> <option value="57">EL SALVADOR</option> <option value="58">EMIRATOS ARABES UNIDOS</option> <option value="188">ERITREA</option> <option value="189">ESLOVAQUIA</option> <option value="59">ESLOVENIA</option> <option value="60">ESPAÑA</option> <option value="61">ESTADOS UNIDOS</option> <option value="62">ESTONIA</option> <option value="63">ETIOPÍA</option> <option value="64">FEDERACIÓN DE RUSIA</option> <option value="65">FIJI</option> <option value="66">FILIPINAS</option> <option value="67">FINLANDIA</option> <option value="68">FRANCIA</option> <option value="69">GABÓN</option> <option value="70">GAMBIA</option> <option value="73">GEORGIA</option> <option value="71">GHANA</option> <option value="74">GIBRALTAR</option> <option value="72">GRANADA</option> <option value="75">GRECIA</option> <option value="190">GROENLANDIA</option> <option value="191">GUADALUPE</option> <option value="192">GUAM</option> <option value="76">GUATEMALA</option> <option value="193">GUAYANA FRANCESA</option> <option value="77">GUINEA</option> <option value="78">GUINEA BISSAU</option> <option value="79">GUINEA ECUATORIAL</option> <option value="80">GUYANA</option> <option value="81">HAITI</option> <option value="82">HOLANDA</option> <option value="83">HONDURAS</option> <option value="194">HONG KONG</option> <option value="84">HUNGRIA</option> <option value="85">INDIA</option> <option value="86">INDONESIA</option> <option value="87">INGLATERRA</option> <option value="89">IRÁN</option> <option value="88">IRAQ</option> <option value="90">IRLANDA</option> <option value="195">ISLA BOUVET</option> <option value="196">ISLA DE CHRISTMAS</option> <option value="197">ISLA NORFOLK</option> <option value="91">ISLANDIA</option> <option value="198">ISLAS CAIMÁN</option> <option value="199">ISLAS COOK</option> <option value="200">ISLAS DE COCOS (KEELING)</option> <option value="201">ISLAS FALKLAND (MALVINAS)</option> <option value="202">ISLAS FAROE</option> <option value="203">ISLAS GEORGIA DEL SUR</option> <option value="204">ISLAS HEARD Y MCDONALD</option> <option value="205">ISLAS MARIANAS DEL NORTE</option> <option value="206">ISLAS MARSHALL</option> <option value="207">ISLAS MENORES PERIFERICAS DE EUA</option> <option value="208">ISLAS SALOMÓN</option> <option value="209">ISLAS TURCAS Y CAICOS</option> <option value="210">ISLAS VÍRGENES BRITÁNICAS</option> <option value="211">ISLAS VIRGENES DE EUA</option> <option value="92">ISRAEL</option> <option value="93">ITALIA</option> <option value="94">JAMAICA</option> <option value="95">JAPON</option> <option value="96">JIBUTI</option> <option value="97">JORDANIA</option> <option value="98">KAZAJSTAN</option> <option value="99">KENIA</option> <option value="100">KIRGUISTAN</option> <option value="101">KIRIBATI</option> <option value="102">KUWAIT</option> <option value="103">LAOS</option> <option value="104">LESOTHO</option> <option value="105">LETONIA</option> <option value="106">LIBANO</option> <option value="107">LIBERIA</option> <option value="108">LIBIA</option> <option value="109">LIECHTENSTEIN</option> <option value="110">LITUANIA</option> <option value="111">LUXEMBURGO</option> <option value="212">MACAU</option> <option value="112">MACEDONIA</option> <option value="113">MADAGASCAR</option> <option value="213">MALASIA</option> <option value="114">MALAWI</option> <option value="115">MALDIVAS</option> <option value="116">MALI</option> <option value="117">MALTA</option> <option value="118">MARRUECOS</option> <option value="214">MARTINICA</option> <option value="119">MAURICIO</option> <option value="120">MAURITANIA</option> <option value="215">MAYOTTE</option> <option value="121">MICRONESIA</option> <option value="122">MOLDOVA</option> <option value="123">MONACO</option> <option value="124">MONGOLIA</option> <option value="216">MONTSERRAT</option> <option value="125">MOZAMBIQUE</option> <option value="217">MYANMAR</option> <option value="126">NAMIBIA</option> <option value="127">NAURU</option> <option value="128">NEPAL</option> <option value="129">NICARAGUA</option> <option value="130">NIGER</option> <option value="131">NIGERIA</option> <option value="218">NIUE</option> <option value="132">NORUEGA</option> <option value="133">NUEVA ZELANDIA</option> <option value="134">OMAN</option> <option value="135">PAISES BAJOS</option> <option value="136">PAKISTÁN</option> <option value="219">PALAU</option> <option value="137">PANAMA</option> <option value="220">PAPUA NUEVA GUINEA</option> <option value="138">PARAGUAY</option> <option value="139">PERÚ/option> <option value="221">PITCAIRN</option> <option value="222">POLINESIA FRANCESA</option> <option value="140">POLONIA</option> <option value="141">PORTUGAL</option> <option value="142">PUERTORICO</option> <option value="223">QATAR</option> <option value="224">REINO UNI.GRAN BRETAÑA E IRLANDA DEL NTE</option> <option value="225">REPÚBLICA ARABE SIRIA</option> <option value="226">REPÚBLICA CENTROAFRICANA</option> <option value="227">REPÚBLICA CHECA</option> <option value="228">REPÚBLICA DE COREA</option> <option value="229">REPÚBLICA DE MOLDOVA</option> <option value="230">REPÚBLICA DEMOCRÁTICA DEL CONGO</option> <option value="231">REPÚBLICA DEMOCRATICA POPULAR DE LAO</option> <option value="232">REPÚBLICA DOMINICANA</option> <option value="233">REPÚBLICA POPULAR DEMOCRÁTICA DE COREA</option> <option value="234">REPÚBLICA UNIDA DE TANZANIA</option> <option value="235">REUNION</option> <option value="236">RUMANIA</option> <option value="143">RWANDA</option> <option value="237">SAHARA OCCIDENTAL</option> <option value="144">SAMOA</option> <option value="238">SAMOA AMERICANA</option> <option value="239">SAN CRISTOBAL Y NEVIS</option> <option value="145">SAN MARINO</option> <option value="240">SAN PIERRE Y MIQUELON</option> <option value="241">SAN VICENTE Y LAS GRANADINAS</option> <option value="242">SANTA HELENA</option> <option value="146">SANTA LUCIA</option> <option value="172">SANTA SEDE (ESTADO CIUDAD DEL VATICANO)</option> <option value="243">SANTO TOME Y PRINCIPE</option> <option value="147">SENEGAL</option> <option value="244">SEYCHELLES</option> <option value="148">SIERRA LEONA</option> <option value="149">SINGAPUR</option> <option value="150">SIRIA</option> <option value="151">SOMALIA</option> <option value="152">SRI LANKA</option> <option value="153">SUDAFRICA</option> <option value="154">SUDÁN</option> <option value="155">SUECIA</option> <option value="156">SUIZA</option> <option value="157">SURINAME</option> <option value="245">SVALBARD Y JAN MAYEN</option> <option value="158">SWAZILANDIA</option> <option value="159">TAILANDIA</option> <option value="246">TAIWAN</option> <option value="160">TANZANIA</option> <option value="247">TAYIKISTAN</option> <option value="248">TERRITORIO BRITANICO DEL OCEANO INDICO</option> <option value="249">TERRITORIOS FRANCESES DEL SUR</option> <option value="250">TIMOR DEL ESTE</option> <option value="161">TOGO</option> <option value="251">TOKELAU</option> <option value="162">TONGA</option> <option value="163">TRINIDAD Y TOBAGO</option> <option value="164">TUNEZ</option> <option value="165">TURQUIA</option> <option value="166">TUVALU</option> <option value="252">UCRANIA</option> <option value="168">UGANDA</option> <option value="169">URUGUAY</option> <option value="170">UZBEKISTAN</option> <option value="171">VANUATU</option> <option value="173">VENEZUELA</option> <option value="174">VIETNAM</option> <option value="253">WALLIS Y FUTUNA</option> <option value="175">YEMEN</option> <option value="176">YUGOSLAVIA</option> <option value="177">ZAIRE</option> <option value="178">ZAMBIA</option> <option value="179">ZIMBABWE</option> <option value="0">OTRO</option> </select> </p> <p> Entidad de nacimiento: <select name="whEntNac" id="whEntNac"> <option value="x"> - Elige un Estado- </option> <option value="0">DISTRITO FEDERAL</option> <option value="1">AGUASCALIENTES</option> <option value="2">BAJA CALIFORNIA NORTE</option> <option value="3">BAJA CALIFORNIA SUR</option> <option value="4">CAMPECHE</option> <option value="5">COAHUILA DE ZARAGOZA</option> <option value="6">COLIMA</option> <option value="7">CHIAPAS</option> <option value="8">CHIHUAHUA</option> <option value="9">DURANGO</option> <option value="10">GUANAJUATO</option> <option value="11">GUERRERO</option> <option value="12">HIDALGO</option> <option value="13">JALISCO</option> <option value="14">ESTADO DE MÉXICO</option> <option value="15">MICHOACÁN DE OCAMPO</option> <option value="16">MORELOS</option> <option value="17">NAYARIT</option> <option value="18">NUEVO LEÓN</option> <option value="19">OAXACA</option> <option value="20">PUEBLA DE LOS ÁNGELES</option> <option value="21">QUERÉTARO</option> <option value="22">QUINTANA ROO</option> <option value="23">SAN LUIS POTOSÍ</option> <option value="24">SINALOA</option> <option value="25">SONORA</option> <option value="26">TABASCO</option> <option value="27">TAMAULIPAS</option> <option value="28">TLAXCALA</option> <option value="29">VERACRUZ DE IGNACIO DE LA LLAVE</option> <option value="30">YUCATÁN</option> <option value="31">ZACATECAS</option> <option value="32">EXTRANJERO</option> </select> </p> <p> <input type="button" value="Pulsa para generar CURP" onclick="btGenCurp(this.form, '3');"><br><br> CURP: <input name="whCurp" id="whCurp" value="" type="text" > </p> </form> <label>Escribe CURP para comprobarla:<br><br> <input type="text" id="valida" oninput="validarInput(this)" > </label> <pre id="resultado"></pre> </font> </body></html>
jueves, 12 de diciembre de 2019
Suscribirse a:
Comentarios de la entrada (Atom)
No hay comentarios.:
Publicar un comentario