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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Sep 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    forms calculating cost for a product selection

    Hey guys i have the following validated html strict code and i wish make a function in java script that allows the user to click on an option value such as
    "Gibson Flying V" then display its cost in the cost option list.

    for example

    product selection (Gibson Flying V)

    Cost (400)

    the cost should automatically change to whatever the user selects in terms of the product any idea's anyone.

    Code:
    <SELECT NAME="mylist">
    <OPTION VALUE="m1">Canora Stratocaster
    
    <OPTION VALUE="m2">Fender Stratocaster
    <OPTION VALUE="m3">Guild Electric
    <OPTION VALUE="m4">Gibson Flying V
    <OPTION VALUE="m5">Monterey
    </SELECT><br></td></tr>
    <tr>  <td align="left">Cost</td>  <td align="left"><SELECT NAME="mylist">
    <OPTION VALUE="m1">$500.00
    <OPTION VALUE="m2">$1000.00
    <OPTION VALUE="m3">$200.00
    <OPTION VALUE="m4">$400.00
    <OPTION VALUE="m5">$3000.00
    </SELECT><br></td></tr>
    <tr>  <td align="left">Are there anymore items</td>
    
          <td align="left"><input type="checkbox" value="Age" size="20">Yes/No</td></tr>
    <tr>  <td align="left">Method of Payment</td>
          <td align="left"><input type="radio" value="Cash" name="pay" size="20">
          Credit<input type="radio" value="Credit" name="pay"size="20">
          Cheque<input type="radio" value="Direct Debit" name="pay"
    size="20">

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,045
    Thanks
    0
    Thanked 251 Times in 247 Posts
    If the order of option items correspond to the same order in another, then you can simply do this:
    Code:
    <select name="mylist" onchange="this.form.mycost.selectedIndex=this.selectedIndex;">
    ...
    </select>
    <select name="mycost">
    ...
    </select>

  • #3
    New to the CF scene
    Join Date
    Sep 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    textfield

    Do also know a way i can apply it to a text field? Iv tried


    <input type = "text" name = "cost" id = "cost of product">


  •  

    Posting Permissions

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