javascript
1<script>
2window.addEventListener('DOMContentLoaded', ()=>{
3 const c=document.querySelectorAll('[name=color]');
4 const p=document.querySelectorAll('[name=part]');
5 c.forEach(x=>x.disabled=true);
6 p.forEach(x=>{
7 x.addEventListener('change',()=>{
8 c.forEach(y=>y.disabled=(y.checked && y.dataset.part!=x.value));
9 });
10 });
11 c.forEach(x=>{
12 x.addEventListener('change',()=>{
13 x.dataset.part=x.checked?[...p].filter(x=>x.checked)[0].value:"";
14 });
15 });
16});
17</script>
18<h2>part</h2>
19<label><input type="radio" name="part" value="1">1</label>
20<label><input type="radio" name="part" value="2">2</label>
21<label><input type="radio" name="part" value="3">3</label>
22<label><input type="radio" name="part" value="4">4</label>
23<h2>color</h2>
24<label style="background-Color:red"><input type="checkbox" name="color" value="red">red</label>
25<label style="background-Color:yellow"><input type="checkbox" name="color" value="yellow">yellow</label>
26<label style="background-Color:lime"><input type="checkbox" name="color" value="lime">lime</label>
27<label style="background-Color:aqua"><input type="checkbox" name="color" value="aqua">aqua</label>
28