---
layout: layouts/page.njk
title: Colorier une carte
---
### La feuille de style
```css
```
### Le tableau
```javascript
```
### Le bouton
```html
```
### La fonction colorier
```javascript
function colorier()
{
for(const region of tableau)
{
if (region.taux <= 5.0)
document.getElementById(region.code).classList.add("niveau1")
else if (region.taux <= 10.0)
document.getElementById(region.code).classList.add("niveau2")
else if (region.taux <= 15.0)
document.getElementById(region.code).classList.add("niveau3")
else if (region.taux <= 19.0)
document.getElementById(region.code).classList.add("niveau4")
else if (region.taux <= 23.0)
document.getElementById(region.code).classList.add("niveau5")
else if (region.taux <= 27.0)
document.getElementById(region.code).classList.add("niveau6")
else if (region.taux <= 31.0)
document.getElementById(region.code).classList.add("niveau7")
else if (region.taux <= 35.0)
document.getElementById(region.code).classList.add("niveau8")
else if (region.taux <= 40.0)
document.getElementById(region.code).classList.add("niveau9")
}
}
```
Voir la [solution](../solution)
Télécharger la solution