当前位置:网站首页>Web APIs exclusivity
Web APIs exclusivity
2022-07-03 05:04:00 【The wind blows and birds fly in the crotch】
Exclusive thoughts :

If you have the same set of elements , We want an element to implement a certain style , Need to use the exclusive thought algorithm of the loop :
All elements clear the style ( Kill the others )
Style the current element ( Leave me alone )
Note that the order cannot be reversed , First kill the others , Set yourself up
<button> Button 1</button>
<button> Button 2</button>
<button> Button 3</button>
<button> Button 4</button>
<button> Button 5</button>
<script>
// 1. Get all button elements
var btns = document.getElementsByTagName('button');
// btns The result is a pseudo array Every element in it btns[i]
for (var i = 0; i < btns.length; i++) {
btns[i].onclick = function() {
// (1) Let's remove all the button background colors first Get rid of everyone
for (var i = 0; i < btns.length; i++) {
btns[i].style.backgroundColor = '';
}
// (2) Then let the current element background color be pink Leave me alone
this.style.backgroundColor = 'pink';
}
}
</script>
边栏推荐
- Notes | numpy-08 Advanced index
- 1118 birds in forest (25 points)
- My first Smartphone
- Market status and development prospects of the global autonomous marine glider industry in 2022
- cookie session jwt
- LVS load balancing cluster of efficient multi-purpose cluster (NAT mode)
- Thesis reading_ ICD code_ MSMN
- Market status and development prospect prediction of the global fire alarm sensor industry in 2022
- Unity tool Luban learning notes 1
- Market status and development prospect prediction of global fermented plant protein industry in 2022
猜你喜欢

Shuttle + alluxio accelerated memory shuffle take-off

Career planning of counter attacking College Students

论文阅读_ICD编码_MSMN

Thesis reading_ ICD code_ MSMN
![[set theory] relational representation (relational matrix | examples of relational matrix | properties of relational matrix | operations of relational matrix | relational graph | examples of relationa](/img/a9/92059db74ccde03b84c69dfce35b37.jpg)
[set theory] relational representation (relational matrix | examples of relational matrix | properties of relational matrix | operations of relational matrix | relational graph | examples of relationa

Thesis reading_ Chinese medical model_ eHealth

并发操作-内存交互操作
![[research materials] 2021 China's game industry brand report - Download attached](/img/b7/a377b0b7c742078e2feb28ebfbca62.jpg)
[research materials] 2021 China's game industry brand report - Download attached
![[set theory] relationship properties (common relationship properties | relationship properties examples | relationship operation properties)](/img/af/8dfa783c87363a9d75c52e7680d508.jpg)
[set theory] relationship properties (common relationship properties | relationship properties examples | relationship operation properties)

Mobile terminal - uniapp development record (public request encapsulation)
随机推荐
Market status and development prospect prediction of the global autonomous hybrid underwater glider industry in 2022
112 stucked keyboard (20 points)
leetcode435. Non overlapping interval
Oracle SQL table data loss
5-36v input automatic voltage rise and fall PD fast charging scheme drawing 30W low-cost chip
Concurrent operation memory interaction
Retirement plan fails, 64 year old programmer starts work again
1110 complete binary tree (25 points)
Market status and development prospect forecast of global heat curing adhesive industry in 2022
Preparation for school and professional cognition
Wechat applet waterfall flow and pull up to the bottom
Thesis reading_ Tsinghua Ernie
Shallow and first code
What is UUID
论文阅读_清华ERNIE
1114 family property (25 points)
Valentine's day limited withdrawal guide: for one in 200 million of you
RT thread flow notes I startup, schedule, thread
论文阅读_中文医疗模型_ eHealth
Literature reading_ Research on the usefulness identification of tourism online comments based on semantic fusion of multimodal data (Chinese Literature)