dcsimg
www.webdeveloper.com
Results 1 to 3 of 3

Thread: Troubleshooting Help

  1. #1
    Join Date
    Jun 2012
    Posts
    2

    Troubleshooting Help

    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.")
    }

  2. #2
    Join Date
    May 2006
    Location
    Somewhere behind your screen
    Posts
    1,674
    use CODE tags when posting your code

  3. #3
    Join Date
    Jun 2012
    Posts
    2
    DO NOT WORRY, I FIXED IT.
    The problem was in that I used "yesnodefault" instead of "choice1(, 2, or 3)"

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles