...

View Full Version : JS order form formatting questions.



trestokes
03-12-2012, 01:43 AM
Hello fellow programmers. I am currently in a JS class and have become stomped on part of the assignment. If anyone can provide guidance on how to format these order form functions, I will be much appreciative.


1. Within the <script> tags at the top of the file, create a function named "loadform()" that displays the current date in the formdate field and then moves the cursor focus to the qtyl field and selects it. Hint: Apply both the focus() and select() methods to the qtyl input box, and run the loadform() function when the page is loaded by the browser.

2. Below the loadform() function, insert a function named total_price that calculates the sum of the numeric values of the sub1 through sub8 fields.

3. Below the total_price function, create a function named tax_price() that adds the values of the sub1 through sub6 fields and then multiples that total by 0.05. Use the dollars() function to display this value rounded to two decimal places.

Attached is a word doc of the program so not to blow this thread up. I should be able to complete the rest of the assignment once I have an understanding about the formats. If anymore information is needed, please let me know.

Philip M
03-12-2012, 09:22 AM
Sorry, we will not do your homework for you. See forum rule #1.5. If you make a substantial effort yourself and post your code here then doubtless someone will help you correct/improve it.

This student assignment has come up before. See for example http://www.codingforums.com/showthread.php?t=253788 It seems to be rather old. Displaying a value with 2 decimal places is best done with .toFixed(2).

All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.

trestokes
03-12-2012, 09:11 PM
Sorry, we will not do your homework for you. See forum rule #1.5. If you make a substantial effort yourself and post your code here then doubtless someone will help you correct/improve it.

This student assignment has come up before. See for example http://www.codingforums.com/showthread.php?t=253788 It seems to be rather old. Displaying a value with 2 decimal places is best done with .toFixed(2).

All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.

Please go look up the definition of the word guidance before you come to my post bashing about doing my homework for me. I obviously don't even know where to start or I would have made an effort. However, thank you for posting the previous thread.

felgall
03-12-2012, 10:17 PM
I obviously don't even know where to start or I would have made an effort.

That's the situation where you definitely need to ask the teacher for help since you either completely missed the class where the material that you are supposed to be using was taught or the teacher did an extremely poor job of explaining it.

The question that you have specifies a number of things that you are supposed to do that are considered to be extremely poor practice for real scripts and so without knowing exactly what constructs that you were supposed to have learnt how to use in order to create this contrived script it is impossible to advise you on where to start. Only your teacher has sufficient information on the purpose of the question to advise you as to which of the hundreds or thousands of possibilities is the one you are supposed to be using.

There ismore than one reason why you mneed to have something approximating the answer before you can ask for help in a forum. That there are lots of solutions to any given problem and that most will not use the code you are supposed to have just learnt means that it isn't just that others don't want to help when you haven't at least got part way yourself - its that we can't help because we have no idea of what code you are supposed to know.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum