I am 14 and made a virtual “gas station” type of web page in Javascript. I made this on my own. My step-father is a web developer and I had more success in troubleshooting than he did. I am extremely good at computers (for my age) and am very smart all-around so I will most likely know what you are talking about. I put the code in below here. Please keep in mind that I wrote the code in Notepad on my PC and saved it as a JS file. I opened it with a Firefox Document (which was, of course, in the same folder). Any help would be great!
Javascript Code:
var grade = prompt(“What grade do you want? nRegular nPremium nDiesel”);
switch ( grade ) {
case “Regular”:
var choice1 = prompt(“Are you sure that you want Regular? nIt’s $3.20.”);
switch ( yesnodefault ) {
case “Yes”:
alert(“Thank you for your purchase.”)
break;
case “No”:
alert(“Have a nice day then.”)
break;
default:
alert(‘This is not an option. Choose either “Yes” or “No.”‘)}
break;
case “Premium”:
var choice2 = prompt(“Are you sure that you want Premium? nIt’s $3.35”);
switch ( yesnodefault ) {
case “Yes”:
alert(“Thank you for your purchase.”)
break;
case “No”:
alert(“Have a nice day then.”)
break;
default:
alert(‘This is not an option. Choose either “Yes” or “No.”‘)}
break;
case “Diesel”:
var choice3 = prompt(“Are you sure that you want Diesel? nIt’s $3.50”);
switch ( yesnodefault ) {
case “Yes”:
alert(“Thank you for your purchase.”)
break;
case “No”:
alert(“Have a nice day then.”)
break;
default:
alert(‘This is not an option. Choose either “Yes” or “No.”‘)}
break;
default:
alert(“This is not a valid grade.”)
}