JSFiddle - React, Tailwind, and code Playground
HTML
<body>
<div id="scoDom" class="score sc1">0</div>
<div id="scoExt" class="score sc2">
<label id="displayExt">0</label>
<div id=plusExt" class="addscoreExt">
<a href="" onclick="incNumber();">
<img src="images/challenge_score_addgoals.png">
</a>
</div>
<div id=plusExt" class="removescoreExt">
<a href="" onclick="decNumber();">
<img src="images/change_score_removegoals.png">
</a>
</div>
</div>
</body>
</html>
CSS
#scoDom
{
position: absolute;
width: 100px;
background-color: aliceblue;
}
#scoExt
{
position: absolute;
width: 100px;
background-color: aliceblue;
}
.score.sc1 {
border-radius: 5px 0 0 5px;
top: 125px;
}
.addscoreExt {
top: -60px;
right: -27px;
position: absolute;
}
.removescoreExt {
top: 10px;
right: -27px;
position: absolute;
}
.score.sc2 {
border-radius: 0 5px 5px 0;
top: 125px;
left: 110px;
}
.score {
font-size: 6em;
line-height: 1em;
width: 105px;
height: 97px;
letter-spacing: -1px;
color: cadetblue; /* changer si = 0 (blanc) pour betonscore ou rouge si perdu (résultat connu) */
background: #fff;
text-align: center;
border: 0 none;
font-family: fantasy;
margin: 0;
padding: 0;
vertical-align: baseline;
}
JavaScript
var i = 0;
function incNumber(i) {
if (i < 10) {
i++;
} else if (i = 10) {
i = 0;
}
document.getElementById("displayExt").innerHTML = i;
}
function decNumber(i) {
if (i > 0) {
--i;
} else if (i = 0) {
i = 10;
}
document.getElementById("displayExt").innerHTML = i;
}