•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 422,406 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,849 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 753 | Replies: 2
![]() |
| |
•
•
Join Date: Feb 2007
Posts: 20
Reputation:
Rep Power: 2
Solved Threads: 0
hi
im new to this javascript business and have a problem with the following code
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> •
•
Join Date: Feb 2007
Posts: 20
Reputation:
Rep Power: 2
Solved Threads: 0
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.
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>•
•
Join Date: Apr 2005
Location: New York state
Posts: 464
Reputation:
Rep Power: 5
Solved Threads: 72
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"
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"
GCS d- s+:+ a-->? C++(++++) UL+++ P+>+++ L+++ !E--- W+++
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r z+*
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r z+*
![]() |
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
cross-browser javascript menu with few lines of code firefox firefox background-position problem solved html javascript javascript show overflow of text by "..." javascript smooth scrolling scroll smoothly window document position javascript tab menu with rounded corners generator prevent javascript menu from getting hidden under flash movies preventing the delay when src attribute of the images set via javascript update panel scroll problem
- Javascript Problem with Firefox (JavaScript / DHTML / AJAX)
- Javascript Problem (Windows 9x / Me)
- Links won't open: Javascript related. (Web Browsers)
- problem in hotmail (Java)
- Page Cannot Be Displayed & javascript:doNetDetect() Errors (Viruses, Spyware and other Nasties)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Selcet/Deselcet All checkbox in Datagrid using Javascript
- Next Thread: select/dropdown in ajax


Hybrid Mode