I've kind of given up on this but Just in case someone can help me. I need to have a password and a username allocated for a user if they select option 2, where the username is the first initial from their forename, the first initial from their last name - and their age, and the password is their age - the last letter of their surname and the last letter of thier first name but i cannot get it to work and i'm giving up as it is only the first question. Here is the code
jscript
var forename;
var surname;
var userName;
var age, ageDiff;
var password;
var option;
option = 0;
document.write('REGISTER'+'<BR>'+
'============================='+'<BR>'+
'What would you like to do?'+'<BR>'+
'<OL>'+
'<LI>'+'Register as a new reader'+'</LI>'+
'<LI>'+'View your details'+'</LI>'+
'<LI>'+'Exit'+'</LI>'+
'</OL>'+
'Enter 1, 2 or 3 to select'+'<BR>')
while (option != 3)
{
option = window.prompt('Please select an option between 1 and 3.','');
option = parseFloat(option);
while (option < 1 || option > 3)
{
option = window.prompt('You must select an option between 1 and 3.','');
option = parseFloat(option);
}
if (option == 1)
{
forename = window.prompt('Please enter your forename ','');
surname = window.prompt('Please enter your surname ', '');
age = window.prompt('Please enter your age ', '');
age = parseFloat(age);
}
if (age < 5 || age > 120)
{
age = window.prompt('Please re enter your age ', '');
age = parseFloat(age);
}
if (age < 5)
{
ageDiff = (5 - age)
document.write('<BR>'+'Sorry, you are too young. Come back in ' + ageDiff + ' year.');
}
else if (option == 1){
{
document.write('<BR>'+'Thank you, ' + forename + ' ' + surname + '.' + ' You are now a member '+'<BR>');
}
if (option == 2)
{
userName = forename.substr(0,1).toUpperCase() + surname.substr(0,1).toUpperCase() + -"+age
password = age+"-"+surname.substr(surname.length-1,1)+forename.substr(forename.length-1,1)
document.write('<BR>'+'<BR>'+'Username: '+ userName + '<BR><BR>Password: '+ password)
}
}
}
document.write('<BR>'+'GOODBYE ');
Mod Edit: Please use code tags when posting your code. They're used like so: =>

Thanks,
PsychoCoder