Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. Flacker0763

    Percentage calculation in a list

    Fantastic fantastic!!! You are a magician with javascript :-) :-) :-) That did the trick, now the rest is easy solvable! If you're ever going to norway, I'll buy you a beer ;-)
  2. Flacker0763

    Percentage calculation in a list

    It won't work to put the function inside the loop, it just takes one costprice and using that for all the SKUs. To get this to work, I need to get the function to read this value somehow.
  3. Flacker0763

    Percentage calculation in a list

    Yes there are different costprices for each SKU, thats making this a bit hard.
  4. Flacker0763

    Percentage calculation in a list

    What if i put this function inside the loop, maybe this will help, because then I might get the costprice like this: function UpdateDG(what) { c = parseFloat(what.value)/<%=costprice%>; d = (c*100)-100; what.form[what.name+'_a'].value = Math.round(d*100)/100 + "%"; }
  5. Flacker0763

    Percentage calculation in a list

    It comes from the database, this is a "Do while not end of file" - "loop" thing, and the costprice is getable for each loop by the name "kostpris". (I think I dont need to translate that word ;) ) If refering to "kostpris" like this: <input type=hidden name=kostpris value="&kostpris&"> it would...
  6. Flacker0763

    Percentage calculation in a list

    Wow that was it! It was the name starting with a number :-) But one issue solved, now I see another comming, is there any way to post the cost-price to this function as well?
  7. Flacker0763

    Percentage calculation in a list

    Here are the code, slightly changed so you don't need to see all TDs in the table. The database connection is also removed, since this works :-) The Javascript function starts at line 17, and the input section starts at line 43. Sub ShowUnitsInCat ShowUpperMenu() ''databaseconnection+++...
  8. Flacker0763

    Percentage calculation in a list

    onkeyup worked perfect on my "test.html". But I still can't get this to work in my real project, is there any easy way to write variables to the screen? maybe alert or something? Because in my project, the percentage shows nothing when entering data in the priceX field.
  9. Flacker0763

    Percentage calculation in a list

    I'm sorry, but I can't see the difference between what I posted last post, and what you posted to me ;-) Here are the source-code from IE when trying to show SKU number 36422 &nbsp;<input name='36422_1' type=text size=5 onkeydown='UpdateDG(this);'> <input name='36422_1_a' type=text size=3...
  10. Flacker0763

    Percentage calculation in a list

    Yes, now the example file works :-) But I still don't get this to work in my project. We have 3 different prices on our SKUs, If a SKUnumber is 34343, the first price is 34343_1, second is 34343_2 and last is 34343_3. The percentage field is 34343_1_a for the first price, 34343_2_a for the...
  11. Flacker0763

    Percentage calculation in a list

    Sorry, my mistake. Here are the file (- the sql part) showing how I have done it. I have 6 "SKUs" here, and I have added functions for the 3 first SKUs. <h1>Price</h1> <form name=form> <script type='text/javascript'> function UpdateDG1() { c = this.form.price1.value/123; d =...
  12. Flacker0763

    Percentage calculation in a list

    I had to do this for each line. I have hard-coded the cost-price (as 123), and experimentet a bit with onkeydown, onchange +++ <form name=form> <script type='text/javascript'> function UpdateDG() { c = this.form.price.value/123; d = (c*100)-100; this.form.percentage.value =...
  13. Flacker0763

    Percentage calculation in a list

    Hi! This is my first post here. I'm new to javascript, but have done a lot of html/asp programming. If I post this on the wrong forum, I'm sorry. My case is like this: I'm making a pricing tool for our intraweb. This tool gets our SKUs from an sql-server. I then have the cost for all SKUs, and...

Part and Inventory Search

Back
Top