473,387 Members | 1,702 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,387 software developers and data experts.

Check if both passwords match

Hello,

I think I nearly have this figured out,

however, what i'd like to do is to check and see if both passwords entered are the same. If they are not what i'd like to do is ask the user to re-enter the new one and confirm the second password again. My current code alerts the user that their passwords do not match and does not ask them to enter the new one and confirm the other password again. Any ideas as to how to loop it until both passwords match?
Expand|Select|Wrap|Line Numbers
  1. <html>
  2.  
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
  5. <title>New Page 1</title>
  6.  
  7. <script type="text/javascript">
  8.  
  9. function test() {
  10.  
  11. var pwd = prompt("Enter a new pwd","")
  12.  
  13. var pwd2 = prompt("Re-enter new pwd","")
  14.  
  15.   if(pwd != pwd2) {
  16.     alert('Your passwords do not match. Please type again.');
  17.     return false;
  18.   }
  19.   return true;
  20. }
  21.  
  22. </script>
  23.  
  24.  
  25. </head>
  26.  
  27. <body onload="test()">
  28.  
  29. </body>
  30.  
  31. </html>
Jun 12 '12 #1
1 3894
Dormilich
8,658 Expert Mod 8TB
call test() in the if() part of the condition.
Jun 12 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: bart plessers | last post by:
Hello, I am developping a file browser bu use of internet explorer. I am already so far that I get a full list of all the files of a selected directory. However, I only want to display...
30
by: S. van Beek | last post by:
Dear reader A record set can be empty because the condition in the query delivers no records. Is there a VBA code to check the status of a record set, record set empty
2
by: jwexqm | last post by:
I'm using a COM DLL from a C# application via an interop wrapper generated by 'tlbimp.exe'. That all works fine, I can fire off methods and things happen as they should. My issue is that I want...
5
by: Paul H | last post by:
In my tblOrderDetails table I have the following fields: OrderID, OrderItemID and DeliveryDate. I need to loop trough each row in an excel spreadsheet and find OrderID and OrderItemID...
8
mmarif4u
by: mmarif4u | last post by:
Hi everybody... I want to enter values to db like the following,,, Format is like this (810605-14-6356) This is the rite format, No a to z letters... 6 digits then - then 2 digits then - then 4...
6
by: JHNielson | last post by:
I have a simple question but I have been pounding on it for a while and nothing will work. I have two tables: and . Basically, I want to delete any records from where the in both tables...
4
by: giftson.john | last post by:
Hi, I am creating an application which migrates all documents from one repository to another repository. Before migration i have to verify all the documents are unique. No duplicates has to be...
3
by: hpjack433 | last post by:
I need a requirement here, i want to use JavaScript so that i don't want users to check both the check boxes. They should check only one and in case if they check both, an alert message should pop up...
2
alexphd
by: alexphd | last post by:
I've been creating this webapp and for some weird reason I cant get this part to work. What I'm trying to do is check for a match on the username and startdate. If there is a match then that user has...
18
by: madhuriks | last post by:
hi, i created one jsp page..in it i used check boxes as well as textboxes..i need to check both the check boxes and textboxes..i tried it but it is validating only the check box not the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.