|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
|
|
<title>Roulette à eau</title>
|
|
|
|
<script type="text/javascript" src="script.js"></script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<svg id="roulette" width="800" height="800">
|
|
|
|
<g stroke="black" stroke-width=2></g>
|
|
|
|
</svg>
|
|
|
|
<script type="text/javascript">
|
|
|
|
let names = new Array();
|
|
|
|
draw_roulette(200, 200, 200, names);
|
|
|
|
</script>
|
|
|
|
<button onclick="rotate()">Tourner</button>
|
|
|
|
<h1 id="winner"></h1>
|
|
|
|
Ajouter quelqu'un: <input id="entry" type="text" name="fname">
|
|
|
|
<input id="submit" type="submit" value="Submit">
|
|
|
|
<ul id="list_person" style="display: grid">
|
|
|
|
|
|
|
|
</ul>
|
|
|
|
<script>
|
|
|
|
document.getElementById('submit').addEventListener('click', function(event){
|
|
|
|
event.preventDefault();
|
|
|
|
names.push(document.getElementById('entry').value);
|
|
|
|
draw_roulette(200, 200, 200, names);
|
|
|
|
let new_element = document.createElement("li");
|
|
|
|
let remove_button = document.createElement('button');
|
|
|
|
remove_button.innerText = "remove";
|
|
|
|
remove_button.onclick = function(){remove_person(names.length-1)};
|
|
|
|
new_element.id = names.length - 1;
|
|
|
|
remove_button.style.display = 'inline';
|
|
|
|
new_element.innerHTML = "<h2 style='display: inline'>"+names.slice(-1)+"</h2>";
|
|
|
|
new_element.appendChild(remove_button);
|
|
|
|
new_element.style.display = "inline";
|
|
|
|
document.getElementById("list_person").appendChild(new_element);
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
|
|
|
|
|