473,382 Members | 1,658 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Please check !

I can't find mistake in this program. I'm writing from Poladn so sorry for
my English.
<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.ha slo.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> Thanks !


Apr 19 '06 #1
1 1016
Marzena wrote on 19 apr 2006 in comp.lang.javascript:
I can't find mistake in this program. I'm writing from Poladn so sorry
for my English.
<script language="JavaScript" type="text/javascript">
Do not use language="JavaScript"
<!--
Do not use <!--
function spr()
{
wzor1=/^[a-z_.,;-]{5,10}$/
wzor2=/^[A-Z]{1}$/
do not use {1}, not needed

wzor2=/^[A-Z]$/

wzor3=/^[0-9]{2}$/
if
((wzor1.test(document.form1.haslo.value)==true)&&( wzor2.test(document.f
orm1.
haslo.value)==true)&&(wzor3.test(document.form1.ha slo.value)==true)){al
ert(" poprawnie wpisane haslo")}
do not use ==true
They can never be true && true && true <<<< THIS IS YOUR MAIN ERROR
Use ||

Try:

var temp = document.form1.haslo.value;
if (wzor1.test(temp)||(wzor2.test(temp)||(wzor3.test( temp ))
alert("Poprawnie wpisane haslo")
else {alert("NIE poprawnie wpisane haslo")};
else
alert("NIE poprawnie wpisane haslo");

}
-->
do not use -->
</script>
</head>
<body>
Podaj haslo:<br>
<form name="form1"> <br>
<form name="form1" onsubmit="spr();return false;">

<input name="haslo"> <br> <br>
<input type="button" value="OK" onclick="spr()">
<input type="button" value="OK">
</form>
</body>
</html> Thanks !



--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Apr 19 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

35
by: wired | last post by:
Hi, I've just taught myself C++, so I haven't learnt much about style or the like from any single source, and I'm quite styleless as a result. But at the same time, I really want nice code and I...
7
by: x muzuo | last post by:
Hi guys, I have got a prob of javascript form validation which just doesnt work with my ASP code. Can any one help me out please. Here is the code: {////<<head> <title>IIBO Submit Page</title>...
1
by: Pax S | last post by:
I need a button that will check (make true) two check boxes (fields) For the record that has the focus (the record on the form that I am presently looking at). The two check boxes would be like a...
4
by: Gary | last post by:
Hello, I'm hoping someone can shed some light on why my report does not output the same results as shown in preview mode, which is to move the position of a check box based on a field value (see...
1
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej...
66
by: genestarwing | last post by:
QUESTION: Write a program that opens and read a text file and records how many times each word occurs in the file. Use a binary search tree modified to store both a word and the number of times it...
1
by: icetalks | last post by:
have a look at this code , its for logging the user in after checking his UserName and Password. dim check as boolean = false ... ... If txtUserName.Text.Length = 0 And txtPass.Text.Length =...
2
by: Unpopular | last post by:
void directory::modification()//??????????? { clrscr(); cout<< "\n\t @@@@@@ @@@@@ @@@@@ @@@@@@ @@@@@ @ @ @@@@@@ "; cout<< "\n\t=====@ @ @ @ @ @ @@...
6
by: shapper | last post by:
Hello, I am creating a form that includes a few JQuery scripts and TinyMCE Editor: http://www.27lamps.com/Beta/Form/Form.html I am having a few problems with my CSS: 1. Restyling the Select
2
by: LilMeechc20 | last post by:
Hello, I have a group assignment that I have to do. We have to write a Tic Tac Toe game. One person in my group has managed to write the code for a multiplayer (human -vs- human) game and I...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.