lol胜率怎么算
```html
body {
fontfamily: Arial, sansserif;
margin: 20px;
}
h1 {
textalign: center;
color: 333;
}
.container {
maxwidth: 500px;
margin: 0 auto;
}
label {
display: block;
marginbottom: 5px;
color: 333;
}
input[type="number"] {
width: 100%;
padding: 10px;
marginbottom: 15px;
border: 1px solid ccc;
borderradius: 5px;
boxsizing: borderbox;
}
button {
width: 100%;
padding: 10px;
backgroundcolor: 4CAF50;
color: white;
border: none;
borderradius: 5px;
cursor: pointer;
}
button:hover {
backgroundcolor: 45a049;
}
.result {
margintop: 20px;
textalign: center;
fontsize: 18px;
color: 333;
}
League of Legends 胜率计算器
document.getElementById('winrateForm').addEventListener('submit', function(event) {
event.preventDefault();
const totalMatches = parseInt(document.getElementById('totalMatches').value);
const totalWins = parseInt(document.getElementById('totalWins').value);
const winrate = calculateWinrate(totalMatches, totalWins);
document.getElementById('result').innerHTML = `胜率:${winrate.toFixed(2)}%`;
});
function calculateWinrate(totalMatches, totalWins) {
if (totalMatches === 0) return 0;
return (totalWins / totalMatches) * 100;
}