请告诉我在以下转换为 float 的 javascript 代码中我在哪里犯了错误
我编写了以下代码来执行 gridview 的一些特定列..但它不起作用,请告诉我我是否失踪了...
function ManipulateGrid()
{
var gvDrv = document.getElementById("<%= GridView1.ClientID %>");
var gt=0.0;
for (i=1; i<gvDrv.rows.length; i++)
{
var cell = gvDrv.rows[i].cells;
var valold = cell[7].innerHTML;
var val = 0.0;
if(isNaN(parseFloat(valold)))
{
val=0.0;
else
val =valold;
}
gt = parseFloat (gt) + val;
}
alert(gt);
}
i wrote following code to do some of a specifice column of gridview.. but its not working please tell me were i am missing...
function ManipulateGrid()
{
var gvDrv = document.getElementById("<%= GridView1.ClientID %>");
var gt=0.0;
for (i=1; i<gvDrv.rows.length; i++)
{
var cell = gvDrv.rows[i].cells;
var valold = cell[7].innerHTML;
var val = 0.0;
if(isNaN(parseFloat(valold)))
{
val=0.0;
else
val =valold;
}
gt = parseFloat (gt) + val;
}
alert(gt);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
它位于括号内的 if 块内和周围。您需要更改 if 块,而不是丢弃转换结果。
或者甚至更好:
It's in and around your bracketed if block. You need to change the if block, and not throw away the conversion results.
Or even better:
您没有正确关闭 if 条件的花括号。应该是这样的
You haven't closed the curly brace for the if condition properly. Should be something like