这是所有的代码.直接替换网页本来的代码就行了,我把JS也放在网页中
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<LINK href="account.css" type="text/css" rel="stylesheet">
<SCRIPT language="javascript" src="Invo.js"></SCRIPT>
<script language="javascript">
<!--
//判断是否为数字
function CheckNum(num)
{
if(isNaN(num))
{
alert("请输入数字");
}
}
//-->
</script>
<script language="javascript" id="clientEventHandlersJS">
<!--
//遍历所有文本框.判断是否为空
function Button2_onclick() {
var jx=0;
var sum=0;
var ob=document.getElementsByTagName("input");
for(var j=0;j<ob.length;j++)
{
if(ob[j].type=="text")
{
if(ob[j].value=="")
{
sum+=1;
}
}
}
if (sum>0)
{
alert("你输入的信息不完整!");
}
}
//增加行
function addrow()
{
var num=TABLE1.rows.length-2;
var newtr =TABLE1.insertRow(num);
var td1= newtr.insertCell(-1);
var td2= newtr.insertCell(-1);
var td3= newtr.insertCell(-1);
var td4= newtr.insertCell(-1);
var td5= newtr.insertCell(-1);
var td6= newtr.insertCell(-1);
td1.innerHTML=num-2;
td2.innerHTML=" <input id='Text4' type='text' class='Text' name='Text4'>";
td3.innerHTML=" <input type='text' id='Text5' class='Text' name='Text5'>";
td4.innerHTML=" <input id='Text6' class='Text' type='text' onchange='CheckNum(Text6.value),cal_total()' name='Text6'>";
td5.innerHTML=" <input class='Text' id='Text7' type='text' onchange='CheckNum(Text7.value),cal_total()' name='Text7'>";
td6.innerHTML="<DIV id='label1' style='DISPLAY: inline; WIDTH: 112px; COLOR: #ff0033; HEIGHT: 15px' ms_positioning='FlowLayout'></DIV>";
}
//删除行
function delrow()
{
if(confirm("是否删除最后一行?"))
{
var i=TABLE1.rows.length-3;
if(i>3)
{
TABLE1.deleteRow(i);
}
else
{
alert("不能第一行删除!");
}
}
}
function cal_total() //统计
{
//alert("OK");
var i; //行数
var Tamount;//总额
var Uprice;//单价
var sum=0; //金额
var qty;//数量
for(i=1;i<Form1.TABLE1.rows.length-1;i++)
{
qty = parseFloat(Form1.Text6(i).value);
Uprice = parseFloat(Form1.Text7(i).value);
Form1.Text7(i).value=Uprice;
Form1.Text6(i).value=qty;
sum=parseFloat( Form1.Text6(i).value)*parseFloat( Form1.Text7(i).value);
sum=Math.round(sum*100)/100;
label1(i).innerText=sum;
//TABLE1.rows(i).cells.innerHTML="<font color='#0000ff'>"+"总金额:"+sum+"</font>";
}
/*
qty = parseFloat(Form1.Text6.value);
Uprice = parseFloat(Form1.Text7.value);
Form1.Text7.value=Uprice;
Form1.Text6.value=qty;
sum=parseFloat( Form1.Text6.value)*parseFloat( Form1.Text7.value);
sum=Math.round(sum*100)/100;
label1.innerText=sum;
// tbl_invoice.rows.cells.innerHTML="<font color='#0000ff'>"+"总金额:"+sum+"</font>";
*/
}
//-->
</script>
<script language="VBScript">
function CheckDate(datestr)
if Isdate(Trim(datestr)) then
datestr=FormatDateTime(CDate(Trim(datestr)))
else
MsgBox "输入日期格式有错",0 ,"日期错误"
end if
datestr=""
end function
</script>
</head>
<body>
<FORM id="Form1" style="TEXT-ALIGN: center" name="Form_InvoiceInfo" onsubmit="return check_submit();"
action="FeeReceipt.aspx" method="post">
<TABLE id="TABLE1" borderColor="#6699cc" height="184" width="750" border="1">
<TR>
<TD bgColor="#6699cc" colSpan="6"> <FONT size="5"> 可视电话移机收费发票 </FONT> <FONT dir="ltr" style="TEXT-ALIGN: right" color="#ff0000">
<FONT color="#ff0000">NO:INC-0611020912-0001 </FONT> </FONT>
</TD>
</TR>
<TR>
<TD width="67" height="8"><FONT face="宋体"> 客户名:</FONT></TD>
<TD height="8"> <INPUT class="Text" id="Text1" type="text" name="Text1"></TD>
<TD height="8"> <FONT face="宋体">类型:</FONT></TD>
<TD height="8"> <INPUT class="Text" id="Text2" type="text" name="Text2"></TD>
<TD height="8"> <FONT face="宋体">日期:</FONT></TD>
<TD height="8"> <INPUT class="Text" id="Text3" type="text" onchange="CheckDate(Text3.value)" name="Text3"></TD>
</TR>
<TR>
<TD borderColor="#6699cc" width="67"><FONT face="宋体">数目</FONT></TD>
<TD borderColor="#6699cc"> <FONT face="宋体">摘要</FONT></TD>
<TD borderColor="#6699cc"><FONT face="宋体">单位</FONT></TD>
<TD borderColor="#6699cc"> <FONT face="宋体">数量</FONT></TD>
<TD borderColor="#6699cc"><FONT face="宋体">单价</FONT></TD>
<TD borderColor="#6699cc"> <FONT face="宋体">金额</FONT></TD>
</TR>
<TR>
<TD width="67"> <FONT face="宋体">1</FONT></TD>
<TD> <INPUT class="Text" id="Text4" type="text" name="Text4"></TD>
<TD> <INPUT class="Text" id="Text5" type="text" name="Text5"></TD>
<TD> <INPUT class="Text" id="Text6" type="text" onchange="CheckNum(Text6.value),cal_total(Form1)"
name="Text6" value="0">
</TD>
<TD> <INPUT class="Text" id="Text7" type="text" onchange="CheckNum(Text7.value),cal_total(Form1)"
name="Text7" value="0"></TD>
<TD>
<DIV id="label1" style="DISPLAY: inline; WIDTH: 112px; COLOR: #ff0033; HEIGHT: 15px"
ms_positioning="FlowLayout"></DIV>
</TD>
</TR>
<TR>
<TD width="67" height="11"> <INPUT id="add" onclick="addrow();" type="button" value="+" name="add"></TD>
<TD height="11"> <INPUT language="javascript" id="del" onclick="delrow();" type="button" value="-" name="Button1"><FONT face="宋体">
合计:</FONT></TD>
<TD height="11"> <FONT face="宋体">总数:</FONT></TD>
<TD height="11">
<DIV style="DISPLAY: inline; WIDTH: 120px; COLOR: #ff0033; HEIGHT: 15px" ms_positioning="FlowLayout"></DIV>
</TD>
<TD height="11"> <FONT face="宋体">总额:</FONT></TD>
<TD height="11">
<DIV style="DISPLAY: inline; WIDTH: 112px; COLOR: #ff0033; HEIGHT: 15px" ms_positioning="FlowLayout"><FONT face="宋体"></FONT></DIV>
</TD>
</TR>
<TR>
<TD width="67"> <FONT face="宋体">经手人:</FONT></TD>
<TD> <INPUT class="Text" id="Text11" type="text" name="Text11"></TD>
<TD> <FONT face="宋体">财务(会计):</FONT></TD>
<TD><FONT face="宋体"><INPUT class="Text" id="Text12" type="text" name="Text12"></FONT></TD>
<TD> <FONT face="宋体">操作人:</FONT></TD>
<TD> <INPUT class="Text" id="Text13" type="text" name="Text13"></TD>
</TR>
</TABLE>
<P><FONT face="宋体"> </FONT><INPUT language="javascript" id="Button2" style="TEXT-ALIGN: center" onclick="return Button2_onclick()"
type="button" value="提交" name="Button2"></P>
<P><FONT face="宋体"></FONT></P>
</FORM>
<SCRIPT language="javascript">
cal_total();
</SCRIPT>
</body>
</html>