当前位置:网站首页>JS的遍历和分支判断(2022年6月24日案例)
JS的遍历和分支判断(2022年6月24日案例)
2022-06-25 15:32:00 【Fairy-KunKun】
/*
时间:2022年6月24日
作者:FairyKunKun
*/
var gridData = s_detail1Obj.getData ();
var sum3 = 0;//sum3用来记录单号开头是3的单号的总数
var sum4 = 0;//sum4用来记录单号开头是4的单号的总数
if ( gridData.length > 0 ) { //遍历所有的数据统计所有表单的3、4开头的总数
for ( i = 0 ; i < gridData.length ; i ++ ) {
if ( gridData[ i ].inbb001.substr ( 0 , 1 ) == "3" ) {
//alert(gridData[i].inbb001.substr(0,1));
sum3 ++;
} else {
//alert(gridData[i].inbb001.substr(0,1));
sum4 ++;
}
}
}
if ( sum3 > 0 && sum4 === 0 ) { //如果只有表单开头是3的
document.getElementById ( "sptj001" ).value = "3";
//给目标表框赋值“3”
} else if ( sum4 > 0 && sum3 === 0 ) { //如果只有表单开头是4的
document.getElementById ( "sptj001" ).value = "4";
//给目标表框赋值“4”
} else {
document.getElementById ( "sptj001" ).value = "5";
//其他情况赋值“5”
}
边栏推荐
- 通过客户经理的开户链接开股票账户安全吗?
- The last glory of the late Ming Dynasty - the battle of Korea
- Sword finger offer 05 Replace spaces
- 剑指 Offer 07. 重建二叉树
- For the first time in Chinese universities! Unique in the world! Tongji students win international awards
- Could not connect to redis at 127.0.0.1:6379 in Windows
- Completabilefuture of asynchronous tools for concurrent programming
- How to convert a recorded DOM to a video file
- MySQL transaction characteristics and implementation principle
- Kali SSH Remote Login
猜你喜欢

免费送书啦!火遍全网的AI给老照片上色,这里有一份详细教程!

MySQL performance optimization - index optimization

If a thread overflows heap memory or stack memory, will other threads continue to work

Brief introduction to class loading process

JMeter reading and writing excel requires jxl jar

双目3D感知(一):双目初步认识
![[paper notes] mcunetv2: memory efficient patch based influence for tiny deep learning](/img/4b/f446bd37057237c0ba4c7b4e38e74f.jpg)
[paper notes] mcunetv2: memory efficient patch based influence for tiny deep learning

Qcodeeditor - QT based code editor

Sword finger offer 05 Replace spaces

Talk about the creation process of JVM objects
随机推荐
Yolov4 coco pre train Darknet weight file
Arthas source code learning-1
About%*s and%* s
Business layer - upper and lower computer communication protocol
客户经理给的开户链接办理股票开户安全吗?我想开个户
MySQL修改字段语句
QT pattern prompt box implementation
golang reverse a slice
Core mode and immediate rendering mode of OpenGL
Sword finger offer 10- I. Fibonacci sequence
Lombok common notes
Leetcode123 timing of buying and selling stocks III
Basic syntax and common commands of R language
Summary of regularization methods
剑指 Offer 06. 从尾到头打印链表
Joseph Ring - formula method (recursive formula)
How to convert a recorded DOM to a video file
Solve the go project compilation error go mod: no such file or directory
Sword finger offer 07 Rebuild binary tree
golang使用mongo-driver操作——增(进阶)