如何在javascript中获取item.count的datalist [英] how to get items.count of datalist in javascript

查看:63
本文介绍了如何在javascript中获取item.count的datalist的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能够获得rows.length并且我循环遍历它以计算no.of单元格



i'm able to get rows.length and i' m looping through it in order to count no.of cells

for (i = 0; i < dlOption.rows.length; i++) {
                       n = n + dlOption.rows[i].cells.length
                   }





但这里的问题是



如果假设我的数据列表包含2行,每行有4列,那么我算得数为8


但实际上它包括两行中的5项,我必须在javascript中获得准确的项目数





其中dloption是我在viewsource中呈现的datalist



But here the problem is

if suppose my datalist contains 2 rows with four columns each, then I'm getting count as 8

But actually it cosnsits 5 items in two rows i have to get exact item count in javascript


where dloption is my rendered datalist in viewsource

推荐答案

这篇关于如何在javascript中获取item.count的datalist的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆