HI I created a calulator that when the ennter button is clicked I want a report to be generated on a new page. I did some seaching on the net and came accross this web site http://www.codepunk.hardwar.org.uk/ajs28.htm I have set up everything to work as the tutorial explains. The cookie is created but when I comes time to "unescape the cookie" it appears nothing is happening. The code for this is very long so below is a link to my webpage http://www.tomorrownextweek.com/calculators/mtgQualCal.php any help or advice is great, I have been scratching my head for three days on this and cannot figure it out thank you
here is the code var convMaxMortgage = mortgageAmout; var convPurchasePrice = Math.round(100*[convMaxMortgage *(1/(1-0.25))])/100; var convDownPayment = Math.round(100*[convPurchasePrice - convMaxMortgage])/100; var convTotalMortgage = Math.round(100*[convPurchasePrice - convDownPayment])/100; var highRatioFiveMaxMortgage = mortgageAmout; var highRatioFivePurchasePrice = Math.round(100*[highRatioFiveMaxMortgage *(1/(1-0.05))])/100; var highRatioFiveDownPayment = Math.round(100*[highRatioFivePurchasePrice - highRatioFiveMaxMortgage])/100; var highRatioFivePremium = Math.round(100*[highRatioFivePurchasePrice * 0.0275])/100; var highRatioFiveTotalMortgage = Math.round(100*[highRatioFivePurchasePrice-highRatioFiveDownPayment + highRatioFivePremium])/100; var highRatioTenMaxMortgage = mortgageAmout; var highRatioTenPurchasePrice = Math.round(100*[highRatioTenMaxMortgage *(1/(1-0.1))])/100; var highRatioTenDownPayment = Math.round(100*[highRatioTenPurchasePrice - highRatioTenMaxMortgage])/100; var highRatioTenPremium = Math.round(100*[highRatioTenPurchasePrice * 0.02])/100; var highRatioTenTotalMortgage = Math.round(100*[highRatioTenPurchasePrice - highRatioTenDownPayment + highRatioTenPremium])/100; var highRatioFifteenMaxMortgage = mortgageAmout; var highRatioFifteenPurchasePrice = Math.round(100*[highRatioFifteenMaxMortgage *(1/(1-0.15))])/100; var highRatioFifteenDownPayment = Math.round(100*[highRatioFifteenPurchasePrice - highRatioFifteenMaxMortgage])/100; var highRatioFifteenPremium = Math.round(100*[highRatioFifteenPurchasePrice * 0.0175])/100; var highRatioFifteenTotalMortgage = Math.round(100*[highRatioFifteenPurchasePrice-highRatioFifteenDownPayment + highRatioFifteenPremium])/100; var highRatioTwentyMaxMortgage = mortgageAmout; var highRatioTwentyPurchasePrice = Math.round(100*[highRatioTwentyMaxMortgage *(1/(1-0.20))])/100; var highRatioTwentyDownPayment = Math.round(100*[highRatioTwentyPurchasePrice - highRatioTwentyMaxMortgage])/100 var highRatioTwentyPremium = Math.round(100*[highRatioTwentyPurchasePrice * 0.01])/100; var highRatioTwentyTotalMortgage = Math.round(100*[highRatioTwentyPurchasePrice - highRatioTwentyDownPayment + highRatioTwentyPremium])/100; //var highRatioTwentyFiveMaxMortgage = mortgageAmout.value; //var highRatioTwentyFivePurchasePrice = highRatioTwentyFiveMaxMortgage *(1/(1-0.20)); //var highRatioTwentyFiveDownPayment = highRatioTwentyFiveDownPayment - highRatioTwentyFiveMaxMortgage; //var highRatioTwentyFiveDownPaymentPremium = highRatioTwentyFivePurchasePrice * 0.0065 //var highRatioTwentyFiveTotalMortgage = highRatioTwentyFivePurchasePrice - highRatioTwentyFiveDownPayment + highRatioTwentyFivePremium; var highRatioFiftyMaxMortgage = mortgageAmout; var highRatioFiftyPurchasePrice = Math.round(100*[highRatioFiftyMaxMortgage *(1/(1-0.20))])/100; var highRatioFiftyDownPayment = Math.round(100*[highRatioTwentyDownPayment - highRatioFiftyMaxMortgage])/100; var highRatioFiftyPremium = Math.round(100*[highRatioFiftyPurchasePrice * 0.005])/100; var highRatioFiftyTotalMortgage = Math.round(100*[highRatioFiftyPurchasePrice - highRatioFiftyDownPayment + highRatioFiftyPremium])/100; // Loan payment calculation var nRate = (document.mtgCal.rate.value); var amt = (document.mtgCal.amort.value); var fiftyam = highRatioFiftyTotalMortgage; var pFreq = 12; // calculate payment var pmtR = ((nRate/100/pFreq)); var pmtF = Math.pow((pmtR+1),amt)-1; var fiftypmtS = (((pmtR / pmtF)+ pmtR))*fiftyam; var fiftypmt = Math.round(100*fiftypmtS)/100; //var twentyfiveyam = highRatioTwentyFiveTotalMortgage; //var twentyfivepmtS = (((pmtR / pmtF)+ pmtR))*twentyfiveam; //var twentyfivepmt = Math.round(100*twentyfivepmtS)/100; var twentyam = highRatioTwentyTotalMortgage; var twentypmtS = (((pmtR / pmtF)+ pmtR))*twentyam; var twentypmt = Math.round(100*twentypmtS)/100; var fifteenam = highRatioFifteenTotalMortgage; var fifteenpmtS = (((pmtR / pmtF)+ pmtR))*twentyam; var fifteenpmt = Math.round(100*fifteenpmtS)/100; var tennam = highRatioTenTotalMortgage; var tenpmtS = (((pmtR / pmtF)+ pmtR))*twentyam; var tenpmt = Math.round(100*tenpmtS)/100; var fivenam = highRatioFiveTotalMortgage; var fivepmtS = (((pmtR / pmtF)+ pmtR))*twentyam; var fivepmt = Math.round(100*fivepmtS)/100; //------------------------------------------------ var mortgageOptions = convPurchasePrice + "xxx" + convDownPayment + "xxx" + convTotalMortgage + "xxx" + convMaxMortgage + "xxx" + highRatioFivePurchasePrice + "xxx" + highRatioFiveMaxMortgage + "xxx" + highRatioFiveDownPayment + "xxx" + highRatioFivePremium + "xxx" + highRatioFiveTotalMortgage + "xxx" + highRatioTenPurchasePrice + "xxx" + highRatioTenMaxMortgage + "xxx" + highRatioTenDownPayment + "xxx" + highRatioTenPremium + "xxx" + highRatioTenTotalMortgage + "xxx" + highRatioFifteenPurchasePrice + "xxx" + highRatioFifteenMaxMortgage + "xxx" + highRatioFifteenDownPayment + "xxx" + highRatioFifteenPremium + "xxx" + highRatioFifteenTotalMortgage + "xxx" + highRatioTwentyPurchasePrice + "xxx" + highRatioTwentyMaxMortgage + "xxx" + highRatioTwentyDownPayment + "xxx" + highRatioTwentyPremium + "xxx" + highRatioTwentyTotalMortgage + "xxx" + highRatioFiftyPurchasePrice + "xxx" + highRatioFiftyMaxMortgage + "xxx" + highRatioFiftyDownPayment + "xxx" + highRatioFiftyPremium + "xxx" + highRatioFiftyTotalMortgage; alert(mortgageOptions) document.cookie = escape(mortgageOptions); window.location = "../testcookie.html"; Code (markup): var mortgageOptions = unescape(document.cookie); var mortgageOptionsSum = mortgageOptions.split("xxx"); alert(mortgageOptions) var convPurchasePrice = mortgageOptionsSum[0]; var convDownPayment = mortgageOptionsSum[1]; var convTotalMortgage = mortgageOptionsSum[2]; var convMaxMortgage = mortgageOptionsSum[3]; var highRatioFivePurchasePrice = mortgageOptionsSum[4]; var highRatioFiveMaxMortgage = mortgageOptionsSum[5]; var highRatioFiveDownPayment = mortgageOptionsSum[6]; var highRatioFivePremium = mortgageOptionsSum[7]; var highRatioFiveTotalMortgage = mortgageOptionsSum[8]; var highRatioTenMaxMortgage = mortgageOptionsSum[9]; var highRatioTenDownPayment = mortgageOptionsSum[10]; var highRatioTenPremium = mortgageOptionsSum[11]; var highRatioTenTotalMortgage = mortgageOptionsSum[12]; var highRatioFifteenPurchasePrice = mortgageOptionsSum[13]; var highRatioFifteenMaxMortgage = mortgageOptionsSum[14]; var highRatioFifteenDownPayment = mortgageOptionsSum[15]; var highRatioFifteenPremium = mortgageOptionsSum[16] var highRatioFifteenTotalMortgage = mortgageOptionsSum[17]; var highRatioTwentyPurchasePrice = mortgageOptionsSum[18]; var highRatioTwentyMaxMortgage = mortgageOptionsSum[19]; var highRatioTwentyDownPayment = mortgageOptionsSum[20]; var highRatioTwentyPremium = mortgageOptionsSum[21]; var highRatioTwentyTotalMortgage = mortgageOptionsSum[22]; var highRatioFiftyPurchasePrice = mortgageOptionsSum[23]; var highRatioFiftyMaxMortgage = mortgageOptionsSum[24]; var highRatioFiftyDownPayment = mortgageOptionsSum[25]; var highRatioFiftyPremium = mortgageOptionsSum[26]; var highRatioFiftyTotalMortgage = mortgageOptionsSum[27]; </script> Code (markup):
this code is not very well written try another: http://www.hotscripts.com/PHP/Scripts_and_Programs/Calculators/index.html