Article View: pl.comp.lang.javascript
Article #39518Re: Sprawdzcie to prosze
From: oio154
Date: Thu, 20 Apr 2006 12:09
Date: Thu, 20 Apr 2006 12:09
64 lines
2369 bytes
2369 bytes
Marzena napisaล(a):
> Program ma sprawdzac poprawnosc hasla, ktore ma sie skladac z: od 5 do 10
> znakow, jednej wielkiej litery i dwoch cyfr. Nie widze bledu.
>
> <script language="JavaScript" type="text/javascript">
> <!--
> function spr()
> {
> wzor1=/^[a-z_.,;-]{5,10}$/
> wzor2=/^[A-Z]{1}$/
> wzor3=/^[0-9]{2}$/
> if
> ((wzor1.test(document.form1.haslo.value)==true)&&(wzor2.test(document.form1.
> haslo.value)==true)&&(wzor3.test(document.form1.haslo.value)==true)){alert("
> poprawnie wpisane haslo")}
> else {alert("NIE poprawnie wpisane haslo")};
> }
> -->
> </script>
> </head>
> <body>
>
>
> Podaj haslo:<br>
> <form name="form1"> <br>
> <input name="haslo"> <br> <br>
> <input type="button" value="OK" onclick="spr()">
> </form>
>
>
> </body>
> </html> Z gory dzieki !
>
<script language="JavaScript" type="text/javascript">
function spr()
{
wzor1=new RegExp("^[A-Za-z0-9_]{5,10}$");
wzor2=new RegExp("^[^A-Z]*[A-Z]{1}[^A-Z]*$");
wzor3=new RegExp("^[^0-9]*[0-9]{1}[^0-9]*[0-9]{1}[^0-9]*$");
if ((wzor1.test(document.form1.haslo.value)==true)
&&(wzor2.test(document.form1.haslo.value)==true)
&&(wzor3.test(document.form1.haslo.value)==true))
window.alert("poprawnie wpisane haslo");
else
window.alert("NIE poprawnie wpisane haslo");
}
</script>
</head>
<body>
Podaj haslo:<br>
<form name="form1"> <br>
<input name="haslo"> <br> <br>
<input type="button" value="OK" onclick="spr()">
</form>
</body>
Technical Details
Message-ID:
<e27tl5$9cl$2@news.onet.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!news.onet.pl!not-for-mailReferences:
<e25jfk$rfg$1@atlantis.news.tpi.pl>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!news.onet.pl!not-for-mail From: oio154 <oio154@polbox.com> Newsgroups: pl.comp.lang.javascript Subject: Re: Sprawdzcie to prosze Date: Thu, 20 Apr 2006 14:09:12 +0200 Organization: Onet.pl Lines: 64 Message-ID: <e27tl5$9cl$2@news.onet.pl> References: <e25jfk$rfg$1@atlantis.news.tpi.pl> NNTP-Posting-Host: ntwklan-62-233-185-146.devs.futuro.pl Mime-Version: 1.0 X-Trace: news.onet.pl 1145534949 9621 62.233.185.146 (20 Apr 2006 12:09:09 GMT) X-Complaints-To: usenet@news.onet.pl NNTP-Posting-Date: Thu, 20 Apr 2006 12:09:09 +0000 (UTC) X-Sender: r+/7Cb33ayUnKBCBuEsUPP1yCF0d0QoW In-Reply-To: <e25jfk$rfg$1@atlantis.news.tpi.pl> User-Agent: Thunderbird 1.5 (Windows/20051201) Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit