SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Jun 2005
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Order Form Price Auto Updated

    Can anyone provide an example or how I would achieve something similar to the order form here: http://www.psd2html.com/order-now.html

    When various radio buttons are clicked the price auto updates at the bottom of the form. I am looking to do something similar, any help would be much appreciated.

    Thanks,
    Brian

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,526
    Mentioned
    83 Post(s)
    Tagged
    3 Thread(s)
    Code javascript:
    var form = document.getElementById('myForm');
    form.onchange = function updatePrice () {
        var price = 0;
        var i, el;
        for (i = 0; i < this.elements.length; i += 1) {
            el = this.elements[i];
            if (test_if_price_field) {
                price += el.value;
            }
        }
        this.elements.totalPrice.value = price;
    };
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


Bookmarks

Posting Permissions

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