wigglesby Posted January 28, 2010 Share Posted January 28, 2010 Hi I have following code: <script type="text/javascript" /> function updateReceivedCartons(){ var cartons = parseFloat(document.getElementById('cartons').value); var remaining = parseFloat(document.getElementById('txtitemsremaining<? echo $recId ?>').value); var received = parseFloat(document.getElementById('txtitemsreceived<? echo $recId ?>').value); var gTotal = cartons - received - remaining; if (gTotal < 0) { alert("The number you entered is too large."); } else { $("#txtitemsreceived<? echo $recId ?>").after("<td class='numbers'><input type='text' disabled='disabled' id='txtitemsreceived<? echo $recId ?>' name='txtitemsreceived<? echo $recId?>' class='teenyinput numbers' value='XXXXXX' /></td>").remove(); } } </script> cartons = 3 received =1 remaining = 1 Now when I set remaining as 1, I then want to pass in the gTotal variables value where XXXXXX is. But I'm not sure how to. So If the above values are set, XXXXXX should be 1 (3 - 1 - 1 = 1). Im just not sure how to the the value of the variable and then pass it into value="XXXXXX" Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/190140-passing-a-variable-to-an/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.