473,581 Members | 3,096 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problem with prompt

1 New Member
I would be grateful if someone could please point out where i have went wrong in the following script. Before i wrote code windows prompted for a number of boxes, now nothing appears, but i cannot figure out where i have went wrong.

thankyou very much

Expand|Select|Wrap|Line Numbers
  1. <HTML>
  2. <HEAD>
  3. <TITLE>Volume Discount</TITLE>
  4.  
  5. <SCRIPT LANGUAGE = "JavaScript">
  6.  
  7. /* A program to tell a customer what volume discount they can expect */
  8.  
  9. var numberOfgiftboxes, 
  10.  
  11.  
  12. numberOfgiftboxes = window.promp
  13.     ('Please enter how many boxes you are purchasing', type how many here, '');
  14. numberOfgiftboxes = parseFloat(numberOfgiftboxes);
  15. if (numberOfgiftboxes >= 0) & & (numberOfgiftboxes <= 3)
  16. {
  17.     document.write('No Discount');
  18. }
  19. else
  20.  
  21.     if (numberOfgiftboxes >= 4) & & (numberOfgiftboxes <= 11)
  22.     {
  23.         document.write('5 % Discount');
  24.     }
  25.     else
  26.  
  27.         if (numberOfgiftboxes >= 12) & & (numberOfgiftboxes < 30)
  28.         {
  29.             document.write('10 % Discount');
  30.         }
  31.         else
  32.  
  33.             if (numberOfgiftboxes >= 30)
  34.             {
  35.                 document.write('20 % Discount');
  36.             }
  37.         }
  38.     }
  39. }
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46. </SCRIPT>
  47. </HEAD>
  48. <BODY>
  49. </BODY>
  50. </HTML>
May 1 '09 #1
2 1358
JosAH
11,448 Recognized Expert MVP
This is a Javascript question, not a Java question; the two languages don't have much in common. I move this thread to the correct forum.

kind regards,

Jos (moderator)
May 1 '09 #2
acoder
16,027 Recognized Expert Moderator MVP
Look at your error console (in a decent browser). It will highlight the errors with error messages and line numbers.

There are a number of problems. Two immediate ones are: on line 9, you need to end the statement with a semi-colon; and on line 12, it's window.prompt, not promp.
May 1 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

14
2127
by: Luka Milkovic | last post by:
Hello, I have a little problem and although it's little it's extremely difficult for me to describe it, but I'll try. I have written a program which extracts certain portions of my received e-mail. The content of the e-mail is actually predictable, it has one very long list of numbers, something looking like this:
1
1016
by: zombay | last post by:
I need a script which by dialog box takes first the number of the marks of a student and then calculate what is the avarege mark. I write such a script (The one which is above) but instead of treating the result of the prompt as numerical it treats them like string. Where is my mistake? <script> MarkN = 0; MarkC = 0; Total = '';
0
1511
by: Laura Zeafla via .NET 247 | last post by:
I have an application I wrote using the Windows Form Application(.NET) wizard. Pressing a button calls a function in a dllwritten in Visual C++. This function is supposed to cause acommand prompt window to open and some information to scroll by.My problem is that using the Windows Form Application wizardprevents the command prompt window from...
6
599
by: Pete | last post by:
Following is a fragment from a program I'm writing. I am trying to enter an 8 bit binary representation from keyboard which is then scanfed into &Ptext and then again into &Key1. This is not binary just a representation, when I print each character in the two char arrays, Key1 displays ok but Ptext is missing the first element. I'm stumped can...
0
1420
by: Paul Hobbs | last post by:
Hi, I wanted to create a function which forced a user to enter no more than a specified number of characters. The code for this is below. The idea was simple, if a user is only meant to enter 10 characters it would throw away any remaining characters. This works fine upto10 characters for example: C:\getstring Command : 123456789...
14
3692
by: Maria Mela | last post by:
Hello everyone... I´ve a problem with my code, when i put this lines: recsize = sizeof(p1); fseek(fp,-recsize,SEEK_CUR); fwrite(&p1,sizeof(p1),1,fp); getch(); The file was saved with correct values and with some windows informations too!?
11
1903
by: gslm | last post by:
Hi! I'm too new on phyton.I have installed phyton.But when I write phyton command, unfortunately, i can't run.I suppose that it is bacause of setting path.But i can't solve. Can you help? Another thing is, when i double click the .py file, there are the project form and the command line.How can i provide to view only the project?...
11
1919
by: aljaber | last post by:
hi, i am facing a problem with my program output here is the program /*********************************************\ * CD Database * * * \*********************************************/
1
2083
by: uk2theusa | last post by:
First of hi to everybody as I'm new here ; ) I have just installed Active Perl 5.8 to my computer running on Windows XP, easy : ) I have my book Perl for Dummies 4th Edition as I am just starting out with Perl & know nothing about writing code in any form. Here is my problem, in my book I am at the section "running active perl in a...
10
1894
by: strife | last post by:
Hey everyone, I was making a program for a class, and I ran into a problem that is driving me crazy. I first suspected Vista, and since I am not home I cannot verify if it just my Vista computer, anyway, here is the problem. I know this is a lame program, but I lacked the creativity to come up with a program including all the...
0
7788
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8139
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8299
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7890
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5667
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3799
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3813
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1398
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1127
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.