日期:2014-05-18  浏览次数:20706 次

高分求字段之间求和,计算的代码
<SCRIPT   language=JavaScript>
<!--

function   totalAccount()
{
document.form1.NumB.value   =   parseInt(document.form1.ItemPrice.value)*parseInt(document.form1.Times.value);
document.form1.NumB.value   =   stringOper(document.form1.NumB.value);
}
function   stringOper(str)
{
        var   length       =   str.length;
var   position   =   str.indexOf( ". ");
var   cha   =   length-position;
if(position   ==   -1)
{
str   =   str+ ".00 ";
}
else   if(cha   ==   1)
{
str   =   str+ "00 ";
}
else   if(cha   ==   2)
{
str   =   str+ "0 ";
}
else   if(cha   >   3)
{
str   =   str.substr(0,(length-(cha-3)));
}
else
{
str   =   str;
}
return   str;
}

//-->
</SCRIPT>
<table   width= "100% "   border= "1 "   cellpadding= "0 "   cellspacing= "0 "   id=t   bordercolorlight= "#808080 "   bordercolordark= "#FFFFFF "   class= "black ">  
    <tr   align= "center "   bgcolor= "#D4D0C8 "   class= "black "   >
        <td   width= "5% "   height= "20 "> 序号 </td>
        <td   width= "13% "> 类别 </td>
        <td   width= "44% "> 项目名称 </td>
        <td   width= "12% "> 单价 </td>
        <td   width= "11% "> 数量 </td>
        <td   width= "10% "> 金额 </td>
        <td   width= "5% "> 删除 </td>
    </tr>
<%   if   (flag   !=   null   &&   flag.equals( "1 "))
{
List     PriceList   =QuotationMng.getresLinePrice(request.getParameter( "line "));
priceListLength   =   PriceList.size();
ResLinePrice   Price;
for(int   i=0;i <5;i++)
{
        if(i <PriceList.size())
{
Price   =   (ResLinePrice)PriceList.get(i);
}
else
{
Price   =   new   ResLinePrice();
}

%>
    <tr   bgcolor= "#FFFFFF ">  
        <td   align= "center ">   <strong> <%=(i+1)%> &nbsp; </strong> </td>
        <td   align= "center "> <input   name= "ItemName "   type= "text "   id= "ItemName1 <%=(i+1)%> "   value= " <%=((Price.getItemName()==null)? " ":Price.getItemName())%> "> </td>
        <td   align= "center "> <input   name= "ItemContent "   type= "text "   id= "ItemContent1 &l