This is a discussion on "Javascript" within the JavaScript Forum section. This forum, and the thread "Javascript are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Javascript
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
Javascript
To all of you wise javascripters,
I entered my text here below, and I am wondering how I would be able to add an "if" statement to the program that after the "confirm,"the program will display an alety box with an error message, if the user presses "cancel" instead of OK? Thank you very much for your time and help. <HTML> <Head> <TITLE>JAVAScript</TITLE> </Head> <BODY> <Script Language:"javascript"> var x= window.prompt("How many Home PC's would you like?>>"); var y= window.prompt("How many Gamer PC's would you like?>>"); var z= window.prompt("How many business PC's would you like?"); var pu= window.prompt("How many Power user PC's would you like?"); window.confirm("Home PC's = "+x+" Gamer PC's ="+y); window.confirm("Business PC's ="+z+" Power User PC's ="+pu); var M = ((x*1)+(y*1)+(z*1)+(pu*1)) var R = ((x*1)+(y*2)+(z*4)+(pu*4)) var C = ((x*1)+(y*0)+(z*1)+(pu*1)) var D = ((x*0)+(y*1)+(z*0)+(pu*1)) document.write("For "+x+" Home PCs, "+y+" Gamer PCs, "+z+" Business PCs, and "+pu+" Power User PCs, you will need to order:"); document.write(" "+M+" Motherboard(s) </p>"); document.write(" "+R+" RAM Module(s) </p>"); document.write(" "+C+" CD/RW drive(s) </p>"); document.write(" "+D+" DVD drive(s) </p>"); document.write("<h1>CALCulator</h1>");1 </script> </body> </html> |
|
|
|
|||
|
|
![]() |
| Tags |
| javascript |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| php and javascript | yvettesio | JavaScript Forum | 8 | Mar 14th, 2007 23:18 |
| JavaScript | cbrams9 | JavaScript Forum | 1 | Sep 20th, 2006 17:35 |
| using xml in javascript | shailu | JavaScript Forum | 0 | Jul 25th, 2006 07:36 |
| Can someone help me with this javascript | Galaxyblue | JavaScript Forum | 2 | Mar 11th, 2004 12:18 |
| what does \\ mean in javascript | jenjen1018 | JavaScript Forum | 5 | Jan 6th, 2004 17:05 |