当前位置:网站首页>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>
边栏推荐
- 论文阅读_ICD编码_MSMN
- JS dynamic table creation
- Uipath practice (08) - selector
- @RequestMapping
- [research materials] the fourth quarter report of the survey of Chinese small and micro entrepreneurs in 2021 - Download attached
- 音频焦点系列:手写一个demo理解音频焦点与AudioMananger
- Literature reading_ Research on the usefulness identification of tourism online comments based on semantic fusion of multimodal data (Chinese Literature)
- Automatic voltage rise and fall 5-40v multi string super capacitor charging chip and solution
- [set theory] relational representation (relational matrix | examples of relational matrix | properties of relational matrix | operations of relational matrix | relational graph | examples of relationa
- Three representations of signed numbers: original code, inverse code and complement code
猜你喜欢

The programmer resigned and was sentenced to 10 months for deleting the code. JD came home and said that it took 30000 to restore the database. Netizen: This is really a revenge

"Hands on deep learning" pytorch edition Chapter II exercise

ZABBIX monitoring of lamp architecture (2): ZABBIX basic operation

String matching: find a substring in a string

Promise

Interface frequency limit access

论文阅读_清华ERNIE

Shuttle + Alluxio 加速内存Shuffle起飞

Coordinatorlayout appbarrayout recyclerview item exposure buried point misalignment analysis

Actual combat 8051 drives 8-bit nixie tube
随机推荐
"Hands on deep learning" pytorch edition Chapter II exercise
Current market situation and development prospect forecast of the global fire boots industry in 2022
1107 social clusters (30 points)
Market status and development prospect forecast of global heat curing adhesive industry in 2022
Celebrate the new year together
Self introduction and objectives
Thesis reading_ Chinese NLP_ ELECTRA
Keepalived热备与HAProxy
Oracle SQL table data loss
112 stucked keyboard (20 points)
I stepped on a foundation pit today
Coordinatorlayout appbarrayout recyclerview item exposure buried point misalignment analysis
[set theory] relationship properties (symmetry | symmetry examples | symmetry related theorems | antisymmetry | antisymmetry examples | antisymmetry theorems)
Wechat applet waterfall flow and pull up to the bottom
Market status and development prospects of the global automatic tea picker industry in 2022
Flutter monitors volume to realize waveform visualization of audio
[SQL injection point] location and judgment of the injection point
Concurrent operation memory interaction
Market status and development prospect prediction of the global autonomous hybrid underwater glider industry in 2022
Gbase8s composite index (I)