Js-web string problem

admin

Administrator
Staff member
hey quick question......

i have a superannuation calculator that calls a .js file to do the calculations.. i need to test this on a site which doesnt have internet access.. for some reason it seems the .js is creating webstrings thus not performing the caculations.. here is the code.... i cant work out what im doing wrong

html calling tag

<head>
</SCRIPT>

<SCRIPT LANGUAGE="JavaScript" src=http://www.webdeveloper.com/forum/archive/index.php/"scripts/pen_ppp.js"></SCRIPT>

<body>

<input type="button" ALT="Compute" value="Compute" onClick=computeppp2001() class="darkText" name="button">



//checks that data are valid



function computeppp2001() {

if(document.ppp2001.nre.value>97200){document.ppp2001.nre.value=97200;alert("The limit for the tax year ending 5 April 2003 is ?7,200. Earnings above this ammount cannot be pensioned through a tax approved scheme.")}
if(document.ppp2001.age.value<1){document.ppp2001.age.value=0;alert("You must enter your age.")}
if(document.ppp2001.nre.value<1){document.ppp2001.nre.value=0;alert("You must enter your income.")}

// maths et al to be computed

if(document.ppp2001.age.value<=35){
document.ppp2001.Gp.value=Math.round(0.175*document.ppp2001.nre.value/12);
document.ppp2001.NBp.value=Math.round(0.175*document.ppp2001.nre.value/12*.78);
document.ppp2001.NHp.value=Math.round(0.175*document.ppp2001.nre.value/12*.6);
}else

if(document.ppp2001.age.value<=45){
document.ppp2001.Gp.value=Math.round(0.20*document.ppp2001.nre.value/12);
document.ppp2001.NBp.value=Math.round(0.20*document.ppp2001.nre.value/12*.78);
document.ppp2001.NHp.value=Math.round(0.20*document.ppp2001.nre.value/12*.6);
}else

if(document.ppp2001.age.value<=50){
document.ppp2001.Gp.value=Math.round(0.25*document.ppp2001.nre.value/12);
document.ppp2001.NBp.value=Math.round(0.25*document.ppp2001.nre.value/12*.78);
document.ppp2001.NHp.value=Math.round(0.25*document.ppp2001.nre.value/12*.6);
}else

if(document.ppp2001.age.value<=55){
document.ppp2001.Gp.value=Math.round(0.3*document.ppp2001.nre.value/12);
document.ppp2001.NBp.value=Math.round(0.3*document.ppp2001.nre.value/12*.78);
document.ppp2001.NHp.value=Math.round(0.3*document.ppp2001.nre.value/12*.6);
}else

if(document.ppp2001.age.value<=60){
document.ppp2001.Gp.value=Math.round(0.35*document.ppp2001.nre.value/12);
document.ppp2001.NBp.value=Math.round(0.35*document.ppp2001.nre.value/12*.78);
document.ppp2001.NHp.value=Math.round(0.35*document.ppp2001.nre.value/12*.6);
}else

if(document.ppp2001.age.value<=74){
document.ppp2001.Gp.value=Math.round(0.4*document.ppp2001.nre.value/12);
document.ppp2001.NBp.value=Math.round(0.4*document.ppp2001.nre.value/12*.78);
document.ppp2001.NHp.value=Math.round(0.4*document.ppp2001.nre.value/12*.6);
}else

{alert("Sorry,you are too old to contribute to a Personal Pension Plan")}

if(document.ppp2001.Gp.value<300){document.ppp2001.Gp.value=300;document.ppp2001.NBp.value=234;document.ppp2001.NHb.value=180}

}

//clears form
function clearppp2001() {

}

//stop hiding from other browsers -->
 
Back
Top