hi

im new to this javascript business and have a problem with the following code

<HTML>
<HEAD>
<TITLE>
SOFASPEND - IN THE BEST POSSIBLE TASTE
</TITLE>
<SCRIPT LANGUAGE = "JavaScript">

/* Program to prompt for a number and then display message according to the response but allowed 2 maximum tries at entering number*/

var response;
var NewCustomer;
var ExistingCustomer;
NewCustomer = 1;
ExistingCustomer = 2;

response = window.prompt('Please enter 1 if you are a new customer or 2 if you are an existing customer','');
response = parseFloat(response);
if (response = '1')
  { document.write('WELCOME – WE WILL SET UP YOUR ACCOUNT DETAILS NOW')
} 
else
{
if (response = '2')
   document.write('SHOP TILL YOU DROP')
};
</SCRIPT>
</HEAD>
<BODY>
</BODY>
</HTML>

right forget the last one now i need to get a window that allows Individuals starting a new account to enter the following data: first name, second name and a password of their own choice.
Passwords must be at least 7, and no more than 15, characters long (there is no restriction on the type of characters allowed). If users enter a password that is invalid according to this rule then the program displays an explanatory message, telling the user how many characters the password entered actually had, and prompts them repeatedly until a valid password is entered. also the entered data must then be used to allocate the new customer a customer code. The customer code is a string made up of the first letter of the first name, plus the first letter of the second name, and a dash.

<HTML>
<HEAD>
<TITLE>
SOFASPEND - IN THE BEST POSSIBLE TASTE
</TITLE>
<SCRIPT 

language="JavaScript" 
type="text/javascript">	

/* Program to prompt for a number and a character and then output that character the specified number of times, each on a separate line */

var response;
var NewCustomer;
var ExistingCustomer;
var FirstName;
var SecondName;
var Password;
NewCustomer = 1;
ExistingCustomer = 2;

response = window.prompt('Please enter 1 if you are a new customer or 2 if you are an existing customer','');
response = parseFloat(response);
if (response == 1)
{
     document.write('WELCOME - WE WILL SET UP YOUR ACCOUNT DETAILS NOW')
     FirstName = window.prompt(Please enter your First Name','');
     SecondName = window.prompt(Please enter you Second Name','');
     Password = window.prompt(Please enter a password between 7 and 15 letters','');
}
else
     {
     if (response == 2)
     { 
         document.write('SHOP TILL YOU DROP')
     }
}

</SCRIPT>
</HEAD>
<BODY>
</BODY>
</HTML>

I would have to seriously recommend you do not use JavaScript to validate the passwords. Use a server-side language so the script cannot be viewed by the public.

If you publish your password rules then you pretty much give bruce-forcers a head start. It's a bit like saying, "I wont tell you the combination but the first number is between 10 and 20, the second is between 5 and 30 and the last is between 0 and 10"

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.