![]() |
JavaScript Functions in separate .js files not working properly
I am very new to JavaScript and am working on an assignment for school that should be very simple but I can't get it working and am not getting much help.
I have a simple HTML file and two .js files each with a function that are all supposed to work together. Currently it will only output the pay calculation and not the overtime or that calcTaxes function at all. Here is my HTML: Code:
Code:
Code:
Ken D. |
Both 1st.js and 2nd.js scripts could be in one file named calcTaxes.js
There are NO HTML tags (like <script ...>) in that text file. Should also be in the same directory unless you change the path. OR Call as 2 separate <script type="text/JavaScript ... tags with the lower case "j" and "s" Code:
<script type="text/javascript" src="calcTaxes.js"> </script> |
his was very helpful as I am just learning I weas curious as to how to create and reference js files so I didnt have to have the scripts in my HTML pages
How can you get the value from a JS function that is in a seperate file to an inputbox on another page? Code:
if (!Array.prototype.reduce) {I am sure I need to reference them differently but not sure how |
Quote:
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> |
?? They do exist??
Again the js works, but not getting the values in my html elements i will move them and see that seemed to do the trick , although my formatDollar doesnt seem to be working |
Quote:
Or try this:- Code:
<script type="text/javascript"> |
I am now getting an error "payments" is undefined
This is the code in a seperate js file Code:
if (!Array.prototype.reduce) { |
| All times are GMT +1. The time now is 05:51 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.