我有表格供客户增加预算预测。 知名用户希望能够以美元、基拉-美元或美加美元显示美元价值。
我试图通过一组称为 Java语功能的无线电台塔尼来实现这一目标,但是在四舍五入时却存在问题,使结果看上去看上去了血清。
任何建议都会受到高度赞赏!
Lynn
function setDollars(new_mode)
{
var factor;
var myfield;
var myval;
var cur_mode = document.proj_form.cur_dollars.value;
if(cur_mode == new_mode)
{
return;
}
else if((cur_mode == d )&&(new_mode == kd ))
{
factor = "0.001";
}
else if((cur_mode == d )&&(new_mode == md ))
{
factor = "0.000001";
}
else if((cur_mode == kd )&&(new_mode == d ))
{
factor = "1000";
}
else if((cur_mode == kd )&&(new_mode == md ))
{
factor = "0.001";
}
else if((cur_mode == md )&&(new_mode == kd ))
{
factor = "1000";
}
else if((cur_mode == md )&&(new_mode == d ))
{
factor = "1000000";
}
document.proj_form.cur_dollars.value = new_mode;
var cur_idx = document.proj_form.cur_idx.value;
var available_slots = 13 - cur_idx;
var td_name;
var cell;
var new_value;
//Adjust dollar values for projections
for(i=1;i<13;i++)
{
var myfield = eval( document.proj_form.proj_ +i);
if(myfield.value == )
{
myfield.value = 0;
}
var myval = parseFloat(myfield.value) * parseFloat(factor);
myfield.value = myval;
if(i < cur_idx)
{
document.getElementById("actual_"+i).innerHTML = myval;
}
}