🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: chile.comp.programacion
Article #532

ayuda con validar rut

#532
From: Rickoj
Date: Fri, 07 Mar 2008 01:41
33 lines
1882 bytes
necesito validar el dichoso rut en un mismo campo de texto con el guion, he 
encontrado varios script qu ehacen lo mismo, pero al aplicarlo no me 
funciona, encontre este que es mas sencillo, pero lo hace en dos campos de 
textos, y lo hace automatico (el digito verificador)

el script

<script language="javascript" type="text/javascript">
<!--

function Text1_onclick() {
    rut = document.getElementById('rut').value;
    document.getElementById('dv').value = dv(rut);
}
function dv(T){var M=0,S=1;for(;T;T=Math.floor(T/10))
S=(S+T%10*(9-M++%6))%11;return S?S-1:'k';}
// -->
</script>

la llamada

<body>
    <input id="rut" type="text" language="javascript" onclick="return 
Text1_onclick()" onkeyup="return Text1_onclick()"  />
    <input id="dv" style="width: 18px" type="text" />

</body>

alguna posibilidad de dejarlo con este mismo script (que es mas sencillo) 
pero que verifique lo escrito antes y despues del -
que no sea lesear con chartat, en demasia?

Saludos
Technical Details
Message-ID: <fqq6gv$uj2$1@news.nivel5.cl>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!news.kjsl.com!news.nivel5.cl!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 1593cb,80adbb2b571c3e5b,start
X-Google-Attributes: gid1593cb,public,usenet
X-Google-Language: SPANISH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!news.kjsl.com!news.nivel5.cl!not-for-mail
From: "Rick_oj" <rick_oj[sin-esto]@tutopia.com>
Newsgroups: chile.comp.programacion
Subject: ayuda con validar rut
Date: Thu, 6 Mar 2008 22:41:54 -0300
Organization: Varios
Lines: 37
Message-ID: <fqq6gv$uj2$1@news.nivel5.cl>
NNTP-Posting-Host: 190.160.70.29
X-Trace: news.nivel5.cl 1204854111 31330 190.160.70.29 (7 Mar 2008 01:41:51 GMT)
X-Complaints-To: news@news.nivel5.cl
NNTP-Posting-Date: Fri, 7 Mar 2008 01:41:51 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198