www.webdeveloper.com
Results 1 to 4 of 4

Thread: Help Coding Store

  1. #1
    Join Date
    Jun 2008
    Posts
    30

    Help Coding Store

    I'm new to JavaScript. I'm trying to create a web store. It's not processing though. Here's my code. What's wrong?

    Code:
    <html>
    
    <head>
    
    <title>Videogame Store</title>
    
    <script language = "javascript">
    
    var order,cost,Games;
    
    function ProcessGamesCallofDuty4()
    {
    Games=1;
    }
    
    function ProcessGamesFallout3()
    {
    Games=1;
    }
    
    function ProcessGamesUnrealTournament3()
    {
    Games=1;
    }
    
    function ProcessGamesMortalKombat()
    {
    Games=1;
    }
    
    function ProcessOrder()
    {
    order = "VideoGames: ";
    cost=1.85
    if(VideoGames.PS3.checked)
      Order += "PS3";
    
    if(VideoGames.360.checked)
      order += "Xbox 360";
    
    if(VideoGames.PC.checked)
      order += "PC";
    
    order += "\nWith:\n";
    
    if(VideoGames.ExtraController.checked)
      {order += " Extra Controller\n";
      cost += .50;}
    
    if(VideoGames.HDMI.checked)
      {order += " HDMI Cable\n";
      cost += .50;}
    
    if(VideoGames.CoolingFan.checked)
      {order += " Cooling Fan\n";
      cost += .50;}
    
    if(VideoGames.system.value=="PS3")
      {order += " PS3\n";
      cost += .50;}
    
    if(ExtraController==1)
      {order += " Extra Controller\n";
      cost += .50;}
    
    cost = parseInt(cost*100)/100;
    
    VideoGames.Order.value = order;
    VideoGames.Cost.value = cost;
    }
    
    </script>
    
    </head>
    
    <body color = "31 b5 d6">
    
    <font color = "00 00 ff" size = "7">
    
    <center>
    
    Videogame Store
    
    </center>
    
    </font>
    
    <form name = "VideoGames">
    
    <table border = "3">
    
    <tr>
    
    <td width = "400">
    
    <u>Acessories</u>
    
    </tr>
    
    <tr height = "12"></tr>
    
    <tr>
    
    <td width = "400"><input type = "checkbox" name = "HDMI Cable">HDMI Cable
    
    <td width = "300"><input type = "checkbox" name = "Extra Controller">Extra Controller
    
    <td width = "400">console:
    
    <input type = "radio" name = "console onClick" = "ProcessConsolesPS3()">PS3
    
    <input type = "radio" name = "console onClick" = "ProcessConsoles360()">360
    
    <input type = "radio" name = "console onClick" = "ProcessConsolesPC()">PC
    
    </tr>
    
    <tr>
    
    <td width = "400"><input type = "checkbox" name = "Cooling Fan">Cooling Fan
    
    <td width = "300"><input type = "checkbox" name = "Xbox Live Annual Subscription">Xbox Live Annual Subscription
    
    </tr>
    
    <tr>
    
    <td width = "400"><input type = "checkbox" name = "Ethernet Cord">Ethernet Cord
    
    <td width = "300"><input type = "checkbox" name = "WiFi Card">WiFi Card
    
    <td width = "400">Games: <select name = "Games">
    
    <opion value = "No">No
    
    <option value = "CallofDuty4"> Call of Duty 4
    
    <option value = "Fallout3"> Fallout 3 
    
    <option value = "UnrealTournament3"> Unreal Tournament 3
    
    <option value = "MortalKombat"> Mortal Kombat vs. DC Universe
    
    </select>
    
    </tr>
    
    </table>
    
    <br><br><br>
    
    <textarea name = "Order" readonly cols = "60" rows = "5" wrap></textarea> Price:
    
    <input name = "Price" readonly>
    
    <center>
    
    <br>
    
    <input type = "reset" value = "reset">
    
    <input type = "button" value = "place order" onclick = "ProcessOrder()">
    
    </center>
    
    </form>
    
    </body>
    
    </html>

  2. #2
    Join Date
    May 2006
    Location
    Odenton, MD
    Posts
    1,449
    i guess you wouldn't like this response, but honestly you should learn some HTML basis before moving to scripting for web document. specially the syntax: opening and closing tags and html attributes. believe it or not, not having a proper coding will make your script to crash.
    my mom is javascript, dad is javascripter, granpa is javascriptor, and my little sister is javasRidiculous.
    my nature language is javascript, then come spanish and english -- me

  3. #3
    Join Date
    Jun 2008
    Posts
    30
    What exactly do you see wrong?

  4. #4
    Join Date
    May 2006
    Location
    Odenton, MD
    Posts
    1,449
    no closing TD elements and, more importantly, no proper definition of arguments. take for example the following lines:
    Code:
    <input type = "radio" name = "console onClick" = "ProcessConsolesPS3()">PS3
    <input type = "radio" name = "console onClick" = "ProcessConsoles360()">360
    <input type = "radio" name = "console onClick" = "ProcessConsolesPC()">PC
    my mom is javascript, dad is javascripter, granpa is javascriptor, and my little sister is javasRidiculous.
    my nature language is javascript, then come spanish and english -- me

Thread Information

Users Browsing this Thread

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

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