473,396 Members | 2,037 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

problem with prompt

1
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 1348
JosAH
11,448 Expert 8TB
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 Expert Mod 8TB
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
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...
1
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...
0
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...
6
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...
0
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...
14
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...
11
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? ...
11
by: aljaber | last post by:
hi, i am facing a problem with my program output here is the program /*********************************************\ * CD Database * * ...
1
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...
10
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.