User Name Password Register
DaniWeb IT Discussion Community
All
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 375,198 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 1,996 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: 690 | Replies: 2
Reply
Join Date: Feb 2007
Posts: 20
Reputation: muddpigeon is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
muddpigeon muddpigeon is offline Offline
Newbie Poster

javascript problem

  #1  
Feb 26th, 2008
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>
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Feb 2007
Posts: 20
Reputation: muddpigeon is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
muddpigeon muddpigeon is offline Offline
Newbie Poster

Help Re: javascript problem

  #2  
Feb 26th, 2008
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>
Reply With Quote  
Join Date: Apr 2005
Location: New York state
Posts: 442
Reputation: ShawnCplus will become famous soon enough ShawnCplus will become famous soon enough 
Rep Power: 5
Solved Threads: 65
Sponsor
ShawnCplus's Avatar
ShawnCplus ShawnCplus is offline Offline
Code Monkey

Re: javascript problem

  #3  
Feb 26th, 2008
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"
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+*
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb JavaScript / DHTML / AJAX Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 2:26 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC