Hi, I have a client who would like to turn a javascript calculator running on his website into an app. There are several calculators, but I'll include the code for one here for an example. It functions correctly on a website, but when I add it to appery it will not work.
This is the code for the calculator itself, which I am placing in an HTML component:
< form name="do2form"
Dissolved oxygen: < input name="do2" type="text" / (%sat) < input onclick="calcdo2wqi()" type="button" value="Calculate" / < input name="do2wqi" type="text" / Water quality index:< /form
This is the javascript that goes with it, which I am running on Page Load:
function calcdo2wqi()
{
var intext=document.do2form.do2;
var outtext=document.do2form.do2wqi;
var xarray=new Array(0.0,16.0,20.0,32.0,34.0,62.0,67.0,70.0,74.0,80.0,84.0,90.0,94.0,98.0,102.0,106.0,137.0,140.0);
var yarray=new Array(2.0,10.0,12.0,20.0,22.0,60.0,70.0,75.0,80.0,87.0,90.0,95.0,98.0,99.0, 99.0, 98.0, 80.0,78.0);
var inval,outval;
var cnt=18;
Code: Select all
if (intext.value=="")
{
inval=intext.value;
outval="Blank";
}
else
{
inval=parseFloat(intext.value);
if (inval140)
{
outval="50";
}
else
{
outval=Math.round(dattowqi(inval,cnt,xarray,yarray));
}
}
}
intext.value=inval;
outtext.value=outval;
} Any input as to why this isn't working and how I might be able to edit the code to make it work would be great. Thanks!