Hey everyone,
This is my firist post, I have been searching for the answer for quite a while and trying many different solutions. I have some java experience but I think I have done something wrong in the code. I'm trying to get the html boxes to update number that is being drawn to the scree when it has been changed. there are 3 boxes that call a function that requires 3 arguments (this is the part I think I'm messing up. Here is the code:
I believe it should work, but as I said I have only done a little with java and I think I'm messing up somewhere with the arguments.Code:<div> <label for="buy">Buy Price: <input type="text" name="buy" id="buy" onchange="solve(this.id,freight.id,markup.id)" value="<?php htmlout($buy); ?>"/></label> </div> <div> <label for="freight">Freight: <input type="text" name="freight" id="freight" onchange="solve(buy.id,this.id,markup.id)" value="<?php htmlout($freight); ?>"/></label> </div> <div> <label for="markup">Markup: <input type="text" name="markup" id="markup" onchange="solve(buy.id,freight.id,this.id)" value="20"/></label>% </div> <div> Sell Price: <script type="text/javascript"> function solve(x,y,z) { var buy=document.getElementById(x).value; var freight=document.getElementById(y).value; var markup=document.getElementById(z).value; var newmarkup; var sell; var markupamount; sell=buy+freight; newmarkup= "0."+markup; var i = Integer.parseInt(newmarkup.trim()); markupamount=sell*i; sell=sell+markupamount; document.write(sell); } </script> </div>
Let me know if you need any more information, thanks heaps for any help you guys can offer!







Bookmarks