SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Guru
    Join Date
    Apr 2007
    Posts
    685
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Make caculation a value

    I have a java script calculation script and it outputs using the following code:

    <input type=text id="prodQty1" size="1" readonly style="border:0;text-align:right;background-color:#eee;">
    I'm trying to make the output of that be the value inside of this:

    <input type="hidden" id="product_avail" name="amount" value="">
    any thoughts?

  2. #2
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Your calculation code is somehow hooking into the first element, probably using the ID (prodQty1). It's difficult to tell what you need to do without seeing the relevant javascript, but it could well be as simple as replacing prodQty1 with product_avail.

  3. #3
    SitePoint Guru
    Join Date
    Apr 2007
    Posts
    685
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Unfortunately, that didn't do the trick. Originally, the calculation shows here:

    Area:&nbsp;<input type=text id="prodArea1" size="3" maxlength="5" onchange="javascript:jsCalcSQFT('prod',1);">
    S/FT + <input type=text id="prodWaste1" size="1" maxlength="2" value="10" onchange="javascript:jsCalcSQFT('prod',1);">
    &#37; Waste = <input type=text id="prodTArea1" size="5" readonly style="border:0;text-align:right;background-color:#eee;">&nbsp;S/F
    = <input type=text id="prodQty1" size="1" readonly style="border:0;text-align:right;background-color:#eee;">&nbsp;Box(es)&nbsp&nbsp;
    If you replicate the <input type=text id="prodQty1" size="1" readonly style="border:0;text-align:right;background-color:#eee;"> it does not show the second time making me feel like it is only calculating once.

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,716
    Mentioned
    102 Post(s)
    Tagged
    4 Thread(s)
    It's not possible to provide effective help without viewing the script that you want us to fix.
    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
  •