Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    May 2004
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help with Price Change/Quote System

    Hey guys. This is my first post here, so please dont flame me. I'm doing this script where i need to have a bunch of radio buttons, and there be a dynamic display at the bottom. IT needs to change for the clicks on the radio buttons. Three groups of the buttons. The price also needs to be displayed in US Dollars and GB Pounds. Here is what i have so far:
    Code:
    nFormElements++;
    
    function onClickItem(o) 
    {
      nCurrentPrice = 0;
    
      for (i=1;i<nFormElements;i++) {
        for (x = 0; x < document.formprice["radio"+i].length; x++) {       
          if (document.formprice["radio"+i][x].checked) {
            nCurrentPrice += parseInt(document.getElementById("label"+i+x).innerHTML.slice(1));
          } 
        }
      }
      document.getElementById('Price').innerText = nCurrentPrice;
    }
    Thanks for your help. Speedy responses please.
    Last edited by WA; 05-07-2004 at 09:57 PM.

  • #2
    New Coder
    Join Date
    May 2004
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok, like 20 people have seen this. Does no one know how to do that?

  • #3
    Regular Coder
    Join Date
    Feb 2003
    Posts
    638
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Mith
    Thanks for your help. Speedy responses please.
    Quote Originally Posted by Mith
    Ok, like 20 people have seen this. Does no one know how to do that?
    Quote Originally Posted by Mith
    This is my first post here, so please dont flame me.
    This is your first post here, Mith, so please don't flame us...
    hmm... ?

  • #4
    New Coder
    Join Date
    May 2004
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Lol. I guess your right. But now its bee like 1000 + so... I know there are some of you that can help.

  • #5
    Regular Coder
    Join Date
    Feb 2003
    Posts
    638
    Thanks
    0
    Thanked 0 Times in 0 Posts
    So, anyway... Welcome Mith, I have a more constructive suggestion to offer this time:

    Try describing exactly what you'd like to accomplish with those radio buttons, and include all of your current code -- along with the elements that your script is referencing.

    Perhaps the price conversion should be opened as a separate topic...
    hmm... ?

  • #6
    New Coder
    Join Date
    May 2004
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ok, well all the jscript is there. Here is the html. I just need for the price to change based upon witch radio button, in a group, is inFocus.
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                          "http://www.w3.org/TR/html4/loose.dtd">
    <html>
      <head>
        <script language="JavaScript" type="text/javascript">
        <!--
            nFormElements = 3;        
        //-->
        </script>
        <script src="javascript.js" type="text/javascript"></script>
        <link rel="stylesheet" href="stylesheet.css" />
        <title>Javascript Price Change</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta name="copyright" content="eFusian.co.uk" />
      </head>
      <body onload="javascript: document.getElementById('Price').innerText = 0;">
    <form action="" name="formprice" method="post">
          <!-- Question 1 Start -->
            <p><span class="header">Number of Pages :</span> <br /> 
              <br />
            
              <input type="radio" name="radio1" value="1" onClick="javascript: onClickItem(this);" />
            6 or Less 
    $70 GBP, $129 USD<br />
            <input type="radio" name="radio1" value="2" onClick="javascript: onClickItem(this);" />
            7 or More
            $100 GBP, $184 USD <br />
            <br />
            <!-- Question 1 End -->
            <!-- Question 2 Start -->
            <span class="header">Dynamic Functions :</span> <br /> 
            <br />
            
            <input type="radio" name="radio2" value="1" onClick="javascript: onClickItem(this);" />
            Login System $10 GBP, $18 USD <br />
            <input type="radio" name="radio2" value="1" onClick="javascript: onClickItem(this);" />
            Database $10 GBP, $18 USD<br />
            <input type="radio" name="radio2" value="1" onClick="javascript: onClickItem(this);" />
            Forum $10 GBP, $18 USD <br />
            <input type="radio" name="radio2" value="1" onClick="javascript: onClickItem(this);" />
            Shopping Cart $10 GBP, $18 USD <br />
            <input type="radio" name="radio2" value="1" onClick="javascript: onClickItem(this);" />
            Forms $10 GBP, $18 USD <br />
            <input type="radio" name="radio2" value="2" onClick="javascript: onClickItem(this);" />
            Any two $20 GBP, $36 USD <br /> 
            <input type="radio" name="radio2" value="3" onClick="javascript: onClickItem(this);" /> 
      Any three $30 GBP, $44 USD<br>
      <input type="radio" name="radio2" value="3.5" onClick="javascript: onClickItem(this);" />
      Any four $35 GBP, $50 USD<br>
      <input type="radio" name="radio2" value="4" onClick="javascript: onClickItem(this);" />
      All five $40 GBP, $55 USD<br />
              <!-- Question 2 End -->
              <!-- Question 3 Start -->
              <span class="header"><br>
              Would you like to buy hosting and domain through us?:</span> <br /> 
              <br />
              
              <input type="radio" name="radio3" value="2" onClick="javascript: onClickItem(this);" />
              Yes <span id="label30">$20</span> <br />
              <input type="radio" name="radio3" value="0" onClick="javascript: onClickItem(this);" />
              No <span id="label31">$0</span><br />
              <!-- Question 3 End -->
              <br /> 
              <br />
              <!-- Display Price Start -->
              <span class="large">Total Price: $</span><span id="Price" class="large"></span>
              <!-- Displa Price End -->    
      </p>
      </form>
      </body>
    </html>
    I know its a bit messed up, but that is all ive got so far.


  •  

    Posting Permissions

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