javascript adding multiple variables to mailto body with a for loop -
this function below supposed add of variables "mess" body of email message. "who" , "what" gets read in email address , subject ok, , first line of mess variables "isbn" gets read body should...but rest of mess variables should read body not entered. wondering if loop not looping correctly. trying narrow problem down. nice.
function mailorder() { who=document.order.email.value; what="order"; var mess = ""; (var n = 0; n < bookdb.length; n++) { booknum = bookdb[n].quantity; if (booknum > 0) { mess += "isbn: " + bookdb[n].number + " "; mess += "book name: " + bookdb[n].title + " "; mess += "quantity ordered: " + bookdb[n].quantity + " "; mess += "book price: " + bookdb[n].price + " "; mess += " ***************************************************** "; } } mess +="customer name: " + document.order.name.value + " "; mess +="email address: " + document.order.email.value + " "; mess +="address: " + document.order.address.value + " "; mess +="city: " + document.order.city.value + " "; mess +="country: " + document.order.country.value + " "; parent.location.href='mailto:'+who+'?subject='+what+'&body='+mess; }
Comments
Post a Comment