You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.4 KiB

<!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="420" height="420">
<g stroke="black" stroke-width=2></g>
</svg>
<button onclick="rotate()" style="display: block;">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>
let names = new Array();
document.getElementById('submit').addEventListener('click', function(event){
event.preventDefault();
names.push(document.getElementById('entry').value);
draw_roulette(10, 10, 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>