View Single Post
Old 02-03-2013, 10:01 AM   PM User | #4
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,105
Thanks: 197
Thanked 2,422 Times in 2,400 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
Quote:
Originally Posted by billboy View Post
document.debtcalc.numberofpayments.value = payments; these represent inputboxes that got populated
document.debtcalc.totalpayments.value = totalpayment; They dont get populated if I place this script in a seperate file
document.debtcalc.intpmt.value = interestPaid; [I]Everything else works so I am referencing it correctly just not populating the HTML boxes properly
}
</script>[/CODE]

If this script is in my HTML page it works fine, but if I place it in a seperate file and reference it from my HTML page then the last 3 lines do NOT work
I am sure I need to reference them differently but not sure how
The HTML elements must exist before they are referenced by the Javascript.
Place your calls to the .js files right in front of the </body> tag. That is the correct place to put scripts.

Code:
<script type="text/javascript" src="calcTaxes.js"> </script>
<script type="text/javascript" src="calcGrossPay.js"> </script>
</body>
__________________

All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.
Philip M is offline   Reply With Quote