D
David C
I have a Javascript function in my aspx page that gives me a different
answer than my calculator. For example, using a price of 415,000.00 and a
Size of 11,200 in my 2 controls I am trying to calculate the price per sq
ft. My Javascript comes up with 37.73 and my calculator comes up with 37.05
and i don't know why. Can anyone help? Below is my Javascript that
references these controls on my aspx page:
function calcpriceper()
{
var otxtsaleprice = document.getElementById('fvProperty_txtSalePrice');
var otxttotalsize = document.getElementById('fvProperty_txtTotalSize');
if (otxtsaleprice.value != '' && otxttotalsize.value != '')
{
var pricepersqft = (parseFloat(otxtsaleprice.value) /
parseFloat(otxttotalsize.value));
//alert('Price/Sq Ft = ' + Math.round(pricepersqft*100)/100);
var osq = document.getElementById('fvProperty_txtsqftprice');
osq.value = (Math.round(pricepersqft*100)/100);
}
}
David
answer than my calculator. For example, using a price of 415,000.00 and a
Size of 11,200 in my 2 controls I am trying to calculate the price per sq
ft. My Javascript comes up with 37.73 and my calculator comes up with 37.05
and i don't know why. Can anyone help? Below is my Javascript that
references these controls on my aspx page:
function calcpriceper()
{
var otxtsaleprice = document.getElementById('fvProperty_txtSalePrice');
var otxttotalsize = document.getElementById('fvProperty_txtTotalSize');
if (otxtsaleprice.value != '' && otxttotalsize.value != '')
{
var pricepersqft = (parseFloat(otxtsaleprice.value) /
parseFloat(otxttotalsize.value));
//alert('Price/Sq Ft = ' + Math.round(pricepersqft*100)/100);
var osq = document.getElementById('fvProperty_txtsqftprice');
osq.value = (Math.round(pricepersqft*100)/100);
}
}
David