View Single Post
Join Date: Mar 2008
Posts: 57
Reputation: complexcodes is an unknown quantity at this point 
Solved Threads: 1
complexcodes complexcodes is offline Offline
Junior Poster in Training

javascript basic:

 
0
  #1
Nov 12th, 2008
My program should allow to display prompt box to enter values for a b and c and should display message in prompt box like "invalid number please enter number again" for a if a ==0 and a is not a number. Same with b , but b can be equal to 0 and has to be a number not any characters. and c can be equal to zero and has to be a number not any characters.
here is my code so far:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <script type="text/javascript">
  2. var aValue;
  3. aValue=window.prompt("What is a's value?","value goes here");
  4. while(aValue==0 ||(isNan(aValue)))
  5. {
  6. aValue=prompt("Invalid number, enter a value again:", " value here");
  7. }
  8. var bValue;
  9. bValue=window.prompt("what is b's value?","value goes here");
  10. while(!(isNan(bValue)))
  11. {
  12. bValue=prompt("Invalid number, enter again:","value here");
  13. }
  14. var cValue;
  15. cValue=prompt("what is c's value?","value goes here");
  16. while(!(isNan(cValue)))
  17. {
  18. cValue=prompt("Invalid number,enter again:","value goes here");
  19. }
  20. </script>

How come it displays prompt box for a only? why am not I able to see prompt box for b and c?

Thanks,
Reply With Quote