I have this form I am trying to get right but I am very stuck! I have looked this up all over the Internet and the answers conflict too much, I need your expertise please. My HTML is:
I accidentally posted that before I was done making it readable. The javascript that I have figured out so far, follows:
Code:
Functions List:
todayTxt()
Returns the current date in the format mm-dd-yyyy
initForm()
Sets up and initializes the Web form.
productCosts()
Returns the total product costs
shipExpense()
Stores the value of the selected shipping option
calcTotal()
Calculates the total cost of the order
calcShipping()
Calculates the total cost of shipping and updates the
total cost of the order
calcCost()
Calculates the cost of each order and updates the total
cost
validateForm()
Validates the form prior to submission
resetForm()
Resets the Web form and Web page
*/
window.onload = initForm;
function todayTxt() {
var Today = new Date();
return Today.getMonth()+1+"-"+Today.getDate()+"-"+Today.getFullYear();
}
function initForm() {
document.order.date.value = todayTxt();
document.order.qty1.focus();
document.order.qty1.select();
}
I really am trying to figure this out, but, I need help from someone better versed in this crazy language to guide me some please!!! I also know I haven't gotten very far yet because I don't know what do to.
Sounds like homework! What are the problems? We are not clairvoyant. Have you tried using your error console? What error messages do you receive? Or are you saying that you want someone to write your Javascript code for you?
__________________
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.
I have an error saying document.order is undefined, I was just making screen-shots to explain to you all where I am stuck so I can figure it out and go on. I was trying to figure out how they want the document.order defined. I am not sure what wording to use.
and this is the javascript that I haven't figured out correctly yet:
Code:
Functions List:
todayTxt()
Returns the current date in the format mm-dd-yyyy
initForm()
Sets up and initializes the Web form.
productCosts()
Returns the total product costs
shipExpense()
Stores the value of the selected shipping option
calcTotal()
Calculates the total cost of the order
calcShipping()
Calculates the total cost of shipping and updates the
total cost of the order
calcCost()
Calculates the cost of each order and updates the total
cost
validateForm()
Validates the form prior to submission
resetForm()
Resets the Web form and Web page
*/
window.onload = initForm;
function todayTxt() {
var Today = new Date();
return Today.getMonth()+1+"-"+Today.getDate()+"-"+Today.getFullYear();
}
//var document orders = initForm();
var document;//orders = function todayTxt() {
//console.log(Today); }
function initForm() {
document.orders.date.value = todayTxt();
document.orders.qty1.focus();
document.orders.qty1.select();
}
I do not see any Javascript in your post - just HTML, and a list of the Javascript functions which you have not written.
I now see you are using XHTML - the name attribute of form is in fact now deprecated, so you should use
document.forms[0].elementname.value;
Quite a few of your questions could be answered by using the search feature of the forum. For example, only the other day at http://www.codingforums.com/showthread.php?t=253698
I posted a script to return the current date in the format mm-dd-yyyy (or whatever you require).
If you are not asking for people to write your code for you, please explain what you are asking for.
__________________
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.
That part was pre-assigned. I am trying to figure out how to word it to define the "document.orders" part so Firebug will let me go on to the next part.
I do not see any Javascript in your post - just HTML, and a list of the Javascript functions which you have not written.
I now see you are using XHTML - the name attribute of form is in fact now deprecated, so you should use
document.forms[0].elementname.value;
Quite a few of your questions could be answered by using the search feature of the forum. For example, only the other day at http://www.codingforums.com/showthread.php?t=253698
I posted a script to return the current date in the format mm-dd-yyyy.
I spent an hour reading posts and searching here before asking. None of them were about this part.
I do not see any Javascript in your post - just HTML, and a list of the Javascript functions which you have not written.
I now see you are using XHTML - the name attribute of form is in fact now deprecated, so you should use
document.forms[0].elementname.value;
Quite a few of your questions could be answered by using the search feature of the forum. For example, only the other day at http://www.codingforums.com/showthread.php?t=253698
I posted a script to return the current date in the format mm-dd-yyyy (or whatever you require).
If you are not asking for people to write your code for you, please explain what you are asking for.
I am trying to understand how to write the code to define the part that was provided .. and get rid of the errors so my pages work correctly. I have looked at stuff all over the net. I need someone to help me understand what is being asked for in the Firebug error and then I hope to continue to learn and finish this particular piece. STill
Code:
window.onload = initForm;
function todayTxt() {
var Today = new Date();
return Today.getMonth()+1+"-"+Today.getDate()+"-"+Today.getFullYear();
}
//var document orders = initForm(); this didn't work :(
var document;//orders = function todayTxt() {
//console.log(Today); } nor this! :P
function initForm() {
document.orders.date.value = todayTxt();
document.orders.qty1.focus();
document.orders.qty1.select();
}
Well, as I say, there is little point in assigning an id to a form field (although it does not hurt so long as you have assigned a name as well).
If you are saying that the HTML is not your work but was provided for you (as was the css), then what part of this is your work?
document.orders will not work because the browser is looking for a form with the name orders.
People here are very willing to help you correct/improve the scripts you have written, but are less keen to do the whole thing for you.
I have to do the JavaScript. I am just not sure how to do this part. I have learned a bunch of XHTML and CSS as you can see in the Index. Janice's JavaScript I am a 52 yr. old twice over cancer survivor working on a new career. I am NOT one of the kids coming here to leech off of your knowledge, I promise!