I need help with a school assignment

You should create a tool where you first be able to register players and then re-register results. The tournament you create will have 4 players, but for full credit should be easy to extend to more players. Each player will play against each of the other players where victory gives a point, draw a half a mark and losses are not eligible. When all the results are registry you should see a list of players by points. This is the task, and this is what i got so far:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title></title>
    <script>
    window.onload = oppdater;
        var listemedspillere = [];
    
       
        
        function oppdater (){
            document.getElementById("reg").onclick = registrer;
            
          
        }
        
        function registrer (){
            
            var player = document.getElementById("spiller").value;
            
            var x = document.getElementById("spillere1");
            var option = document.createElement("option");
            option.text = player;
            x.add(option);
            listemedspillere.push(player);
            
            var y = document.getElementById("spillere2");
            var option = document.createElement("option");
            option.text = player;
            y.add(option, y[0]);
            
        }
        
        
        
    
    
    
    </script>
    
    
    </head>
    <body>
         <h1>Sjakkturnering:</h1>
        <p id="hei"></p>
        <input id="spiller" type="text" placeholder="Registrer en ny spiller">
        <button id="reg">Legg til spiller</button>
        </br>
        <select id="spillere1"></select>
        <select id="spillere2"></select>
    </br>
    <button id="vinn">Vant</button>
    <button id="tapp">Tap</button>
    <button id="uavgjort">Uavgjort</button>
        
        
       
    </body>


</html>

We tend to not help with peoples homework in terms of code, but we certainly can help to give ideas and advice.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.