質問編集履歴
1
追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -16,4 +16,24 @@
|
|
16
16
|
});
|
17
17
|
}
|
18
18
|
</script>
|
19
|
+
```
|
20
|
+
|
21
|
+
```ここに言語を入力
|
22
|
+
思いついた方法
|
23
|
+
これだとすべてのオブジェクトを判定し、無駄が多い
|
24
|
+
|
25
|
+
他に書き方があれば教えてください
|
26
|
+
<div style="background-color:red">a</div>
|
27
|
+
<button style="background-color:red">a</button>
|
28
|
+
|
29
|
+
|
30
|
+
<script>
|
31
|
+
window.onload=function(){
|
32
|
+
Array.from(document.querySelectorAll("*"), i => {
|
33
|
+
if(i.style.backgroundColor=="red"){
|
34
|
+
i.style.backgroundColor="blue";
|
35
|
+
}
|
36
|
+
});
|
37
|
+
}
|
38
|
+
</script>
|
19
39
|
```
|