| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 602 人关注过本帖
标题:求教JS错误-->千里冰封转移
只看楼主 加入收藏
winsonjie
Rank: 1
等 级:新手上路
帖 子:129
专家分:0
注 册:2006-5-20
收藏
 问题点数:0 回复次数:2 
求教JS错误-->千里冰封转移

for(i=1;i<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;
tbl_invoice.rows(i).cells(5).innerHTML="<font color='#0000ff'>"+"总金额:"+sum+"</font>";
}
这是JS的,为什么我一用循环,用数组它就会说 qty = parseFloat(Form1.Text6(i).value)这些涉及到数组的就;有错
"对象不支持此属性或方法",不用循环,不用数组就可以

搜索更多相关主题的帖子: JS 千里冰封 
2006-11-12 15:31
yueritian
Rank: 1
等 级:新手上路
帖 子:83
专家分:0
注 册:2006-7-26
收藏
得分:0 

把完整代码贴出来


22岁的我,没有皱纹的我
2006-11-13 10:45
winsonjie
Rank: 1
等 级:新手上路
帖 子:129
专家分:0
注 册:2006-5-20
收藏
得分:0 

这是所有的代码.直接替换网页本来的代码就行了,我把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="&nbsp;<input id='Text4' type='text' class='Text' name='Text4'>";
td3.innerHTML="&nbsp;<input type='text' id='Text5' class='Text' name='Text5'>";
td4.innerHTML="&nbsp;<input id='Text6' class='Text' type='text' onchange='CheckNum(Text6.value),cal_total()' name='Text6'>";
td5.innerHTML="&nbsp;<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">&nbsp;<FONT size="5">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;可视电话移机收费发票&nbsp;</FONT>&nbsp;<FONT dir="ltr" style="TEXT-ALIGN: right" color="#ff0000">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<FONT color="#ff0000">NO:INC-0611020912-0001&nbsp;</FONT>&nbsp;</FONT>
</TD>
</TR>
<TR>
<TD width="67" height="8"><FONT face="宋体">&nbsp;&nbsp;客户名:</FONT></TD>
<TD height="8">&nbsp;<INPUT class="Text" id="Text1" type="text" name="Text1"></TD>
<TD height="8">&nbsp;&nbsp;<FONT face="宋体">类型:</FONT></TD>
<TD height="8">&nbsp;<INPUT class="Text" id="Text2" type="text" name="Text2"></TD>
<TD height="8">&nbsp;&nbsp;<FONT face="宋体">日期:</FONT></TD>
<TD height="8">&nbsp;<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">&nbsp;<FONT face="宋体">摘要</FONT></TD>
<TD borderColor="#6699cc"><FONT face="宋体">单位</FONT></TD>
<TD borderColor="#6699cc">&nbsp;<FONT face="宋体">数量</FONT></TD>
<TD borderColor="#6699cc"><FONT face="宋体">单价</FONT></TD>
<TD borderColor="#6699cc">&nbsp;<FONT face="宋体">金额</FONT></TD>
</TR>
<TR>
<TD width="67">&nbsp;<FONT face="宋体">1</FONT></TD>
<TD>&nbsp;<INPUT class="Text" id="Text4" type="text" name="Text4"></TD>
<TD>&nbsp;<INPUT class="Text" id="Text5" type="text" name="Text5"></TD>
<TD>&nbsp;<INPUT class="Text" id="Text6" type="text" onchange="CheckNum(Text6.value),cal_total(Form1)"
name="Text6" value="0">
</TD>
<TD>&nbsp;<INPUT class="Text" id="Text7" type="text" onchange="CheckNum(Text7.value),cal_total(Form1)"
name="Text7" value="0"></TD>
<TD>&nbsp;
<DIV id="label1" style="DISPLAY: inline; WIDTH: 112px; COLOR: #ff0033; HEIGHT: 15px"
ms_positioning="FlowLayout"></DIV>
</TD>
</TR>
<TR>
<TD width="67" height="11">&nbsp;<INPUT id="add" onclick="addrow();" type="button" value="+" name="add"></TD>
<TD height="11">&nbsp;<INPUT language="javascript" id="del" onclick="delrow();" type="button" value="-" name="Button1"><FONT face="宋体">
合计:</FONT></TD>
<TD height="11">&nbsp;<FONT face="宋体">总数:</FONT></TD>
<TD height="11">&nbsp;
<DIV style="DISPLAY: inline; WIDTH: 120px; COLOR: #ff0033; HEIGHT: 15px" ms_positioning="FlowLayout"></DIV>
</TD>
<TD height="11">&nbsp;<FONT face="宋体">总额:</FONT></TD>
<TD height="11">&nbsp;
<DIV style="DISPLAY: inline; WIDTH: 112px; COLOR: #ff0033; HEIGHT: 15px" ms_positioning="FlowLayout"><FONT face="宋体"></FONT></DIV>
</TD>
</TR>
<TR>
<TD width="67">&nbsp;<FONT face="宋体">经手人:</FONT></TD>
<TD>&nbsp;<INPUT class="Text" id="Text11" type="text" name="Text11"></TD>
<TD>&nbsp;<FONT face="宋体">财务(会计):</FONT></TD>
<TD><FONT face="宋体"><INPUT class="Text" id="Text12" type="text" name="Text12"></FONT></TD>
<TD>&nbsp;<FONT face="宋体">操作人:</FONT></TD>
<TD>&nbsp;<INPUT class="Text" id="Text13" type="text" name="Text13"></TD>
</TR>
</TABLE>
<P><FONT face="宋体">&nbsp; </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>


2006-11-13 21:01
快速回复:求教JS错误-->千里冰封转移
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.030953 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved