JavaScript Server API Hilfe?

Hallo,

meine Aufgabe:

wenn ich zum Beispiel bei login: babyshark2 schreibe und bei password: 123, und dann auf "send" drücke, dann werden ja diese Daten und zusätzlich noch isLogin: false auf Backend Server geschickt. Wenn ich aber beim zweiten Mal nochmal diese inputs mit den gleichen Daten ausfülle (babyshark2, 12) und dann aber auf "login" drücke, dann sollte das Programm zwischen alle Loginnamen genau diesen Loginname (babyshark2) finden, und falls das Passwort auch richtig ist, dann sollte das isLogin: auf true gesetzt werden. Aber ich verstehe gar nicht wie ich das weitermachen soll. Bitte helft mir!

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>CRUD</title>
  <link rel="stylesheet" href="./style.css">
  <script defer src="./script.js"></script>
</head>
<body>
  <form class="form">
    <input id="loginInput" type="text" placeholder="Login">    
    <input id="passwordInput" type="password" placeholder="Password">    
    <button id="sendButton">Send</button>
    <button id="loginButton">Login</button>
    <p class="p">If you want to delete an Item press the button "Delete" twice to confirm it!</p>


    <div id="userTable"></div>
  </form>
</body>
</html>
JAVASCRIPT IST IN DEN KOMMENTAREN; DA ES HIER NICHT PASST!

MfG

MrOsmo

Software, HTML, IT, Webseite, programmieren, JavaScript, HTML5, Code, Informatik, Programmiersprache, Webentwicklung, Frontend
javascript api probleme?

Hallo,

guckt euch mal meinen Code an.

JAVASCRIPT:

// INPUT
const login = document.getElementById("loginInput");
const password = document.getElementById("passwordInput");
const button = document.getElementById("sendButton");


// FETCH
const url = "https://crudcrud.com/api/4b3acc467d8c47d8a608bb9820171935/todos"



const dataRender = (array) => {
  if (array === undefined) {
    console.log("Loading results...");
  } else {
    let dataList = array.map((item) => {
      return `
      <div class="users">
        <p>${item.login}</p>
        <button onclick="deleteRequest(${item.id})">Delete</button>
        </div>
        `;
    });
    const getHtml = document.getElementById("userTable");
    getHtml.innerHTML = dataList.join("");
  }
};


const fetchData = async () => {
  try {
    const response = await fetch(url);
    const data = await response.json();
    dataRender(data);
  } catch (error) {
    console.error(error);
  }
};



fetchData();


const postRequest = async () => {
  const data = {
    login: login.value,
    password: password.value,
    isLogin: false,
  };


  try {
    const response = await fetch(url, {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
      },
      body: JSON.stringify(data),
    });


    const results = await response.json();
    console.log(results.message);
  } catch (error) {
    console.error(error);
  }


};


button.addEventListener("click", postRequest);


const deleteRequest = async (id) => {
  try {
    const response = await fetch(`${url}/${id}`, {
      method: "DELETE",
      headers: {
        "Content-Type": "application/json",
      }
    })
    const results = await response.json()
    console.log(results.message);
  }
  catch (error) {
    console.error(error);
  }
}

HTML:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>CRUD</title>
  <script  defer src="./script.js"></script>
</head>
<body>
  <form>
    <input id="loginInput" type="text" placeholder="Login">    
    <input id="passwordInput" type="password" placeholder="Password">    
    <button onclick="" id="sendButton">Send</button>


    <div id="userTable">
      
    </div>
  </form>
</body>
</html>

Mein Ziel:

Wenn ihr auf das button "Send" drückt, dann erscheint ja der value von dem input "login" auf HTML (innerHTML heisst das glaube ich). Und zusammen mit dem value erscheint auch ein anderer Button namens "Delete". Mein Ziel ist es, dass wenn ich auf "Delete" drücke, dann sollte das item aus Backend-Server und aus HTML gelöscht werden. Aber das klappt bei mir die ganze Zeit nicht. Einfacher ist es wenn ihr meinen Code einfügt und selber mal den Code testet, dann werdet ihr verstehen, was ich machen will.

Bitte helft mir! Ich sitze schon wirklich lange dranrum und ohne Erfolg!

Dankeschön im Voraus!

MfG

MrOsmo

Software, App, HTML, IT, Webseite, programmieren, JavaScript, HTML5, Code, Informatik, Programmiersprache, Webentwicklung, Frontend
C++ - "Funktion nimmt keine 0 Argumente." Behebung?

Schönen guten Abend!

Das Problem ist etwas anders als in der Frage, jedoch ist es für mich schwer dies in einem Satz zu erklären. Nun erstmal mein C++ Quellcode zum Verständnis:

#include <iostream>


int numbCount(int count);


int main()
{
	int num1 = numbCount();
	int num2 = numbCount(2);

  ...

}
  
  int numbCount(int count = 1) 
  {
  	int userNumb;
  	std::cout << "Please enter the " << count << ". integer: ";
  	std::cin >> userNumb;
  
  
  	return userNumb;
  }

Also, wie man sehen kann hat meine Funktion numbCount() Parameter. Außerdem bevorzuge ich es die Funktionsdefinition unter der Main() Funktion zu schreiben.

int numbCount(int count);

int main()
{
...
}

int numbCount(int count = 1)
{
...
}

Somit muss ich die Funktionsdeklaration über der Main() Funktion "erwähnen", damit ja der Compiler weiß, dass die Definition noch kommt. Dies scheint in diesem Fall bei einer Funktion mit Standardparameter für VS ein Problem darzustellen - Fehler "numbCount: function does not take 0 arguments".

Wenn ich jedoch die Funktionsdefinition von "numbCount()" über die Main() Funktion packe, funktioniert alles normal.

int numbCount(int count = 1)
{
...
}

int main()
{
...
}

Habe bereits versucht den Parameter in der "erwähnten" Funktionsdeklaration zwischen den runden Klammern ebenfalls einzufügen, also

int numbCount(int count = 1);

jedoch kommt dann der Fehler 'numbCount': redefinition of default argument: parameter 1

FRAGE:
Gibt es eine Möglichkeit in einer Funktion Standardparamter (also wenn kein Wert in Funktionsaufruf zwischen Klammern angegeben -> standardm. Wert 1) zu haben aber trotzdem die Funktionsdefinition unter der Main() Funktion zu belassen?

int numbCount(int count);

int main()
{
    int num1 = numbCount(); // Kein Wert angegeben - Std. Wert 1
    int num2 = numbCount(2);
}

int numbCount(int count = 1)
{
...
}

Vielen Dank und einen schönen Abend! :)

Computer, Software, Programm, programmieren, Anwendung, Funktion, Cplusplus, Anwendungsentwicklung, Argumente, Code, CPP, Fehlerbehebung, fehlercode, Programmiersprache, Softwareentwicklung, Visual Studio, Fehlermeldung, Parameter
was bedeuted das?
C:\Users\admin\Desktop\app> pip install turtle
Collecting turtle
 Downloading turtle-0.0.2.tar.gz (11 kB)
 Installing build dependencies ... done
 Getting requirements to build wheel ... error
 error: subprocess-exited-with-error

 × Getting requirements to build wheel did not run successfully.
 │ exit code: 1
 ╰─> [22 lines of output]
     Traceback (most recent call last):
       File "C:\Users\admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
         main()
       File "C:\Users\admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
         json_out['return_val'] = hook(**hook_input['kwargs'])
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       File "C:\Users\admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
         return hook(config_settings)
                ^^^^^^^^^^^^^^^^^^^^^
       File "C:\Users\admin\AppData\Local\Temp\pip-build-env-9moh374e\overlay\Lib\site-packages\setuptools\build_meta.py", line 325, in get_requires_for_build_wheel
         return self._get_build_requires(config_settings, requirements=['wheel'])
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       File "C:\Users\admin\AppData\Local\Temp\pip-build-env-9moh374e\overlay\Lib\site-packages\setuptools\build_meta.py", line 295, in _get_build_requires
         self.run_setup()
       File "C:\Users\admin\AppData\Local\Temp\pip-build-env-9moh374e\overlay\Lib\site-packages\setuptools\build_meta.py", line 480, in run_setup
         super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script)
       File "C:\Users\admin\AppData\Local\Temp\pip-build-env-9moh374e\overlay\Lib\site-packages\setuptools\build_meta.py", line 311, in run_setup
         exec(code, locals())
       File "<string>", line 40
         except ValueError, ve:
                ^^^^^^^^^^^^^^
     SyntaxError: multiple exception types must be parenthesized
     [end of output]

 note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip
cmd, Code, Programmiersprache, Python, Python 3
HTML Taschenrechner?

Hey ich habe einen HTML Taschenrechner von einer Website kopiert von einer Website und ich will jetzt den Taschenrechner so programmieren das er nicht über hundert rechen kann bzw. Eine Fehler Meldung dann kommt so das immer ein Fehler kommt wenn ich über hundert rechnen tun ich hab schon im Internet mich belesen aber finde nix leider vielleicht könnt ihr mir helfen

<html>
<head>
<title>HTML-Taschenrechner </title>
</head>
<body bgcolor= "# 000000" text= "gold">
<form name="calculator" >
<input type="button" value="1" onClick="document.calculator.ans.value+='1'">
<input type="button" value="2" onClick="document.calculator.ans.value+='2'">
<input type="button" value="3" onClick="document.calculator.ans.value+='3'">
<input type="button" value="+" onClick="document.calculator.ans.value+='+'">
<input type="button" value="4" onClick="document.calculator.ans.value+='4'">
<input type="button" value="5" onClick="document.calculator.ans.value+='5'">
<input type="button" value="6" onClick="document.calculator.ans.value+='6'">
<input type="button" value="-" onClick="document.calculator.ans.value+='-'">
<input type="button" value="7" onClick="document.calculator.ans.value+='7'">
<input type="button" value="8" onClick="document.calculator.ans.value+='8'">
<input type="button" value="9" onClick="document.calculator.ans.value+='9'">
<input type="button" value="*" onClick="document.calculator.ans.value+='*'">
<input type="button" value="/" onClick="document.calculator.ans.value+='/'">
<input type="button" value="0" onClick="document.calculator.ans.value+='0'">
<input type="reset" value="Reset">
<input type="button" value="=" onClick="document.calculator.ans.value=eval(document.calculator.ans.value)">
Solution is
<input type="textfield" name="ans" value="">
</form>
</body>
</html>

LG

HTML, Webseite, HTML5, Code, Programmiersprache, Webdesign, Webentwicklung
BlueJ Methode für eine private Nachricht?

Hier ist der Code, ich brauche eine Methode mit der ich eine Nachricht an einen User an einen Server senden kann der nur dieser User sieht

public class EchoServer extends Server {

public EchoServer(int port) {

super(port);

System.out.println("Der DBG-ECHO-Server hat die IP " + getIP() + " und lauscht auf Port " + port + "!");

}

public void processNewConnection(String pClientIP, int pClientPort) {

System.out.println("Neue Verbindung von " + pClientIP + " : " + pClientPort + ".");

send(pClientIP, pClientPort, "Herzlich willkommen beim DBG-ECHO-Server, Quit um abzumelden, Everybody für Message an alle");

}

public void processMessage(String pClientIP, int pClientPort, String pMessage) {

if (pMessage.equals("Quit")) {

closeConnection(pClientIP, pClientPort);

}

if (pMessage.substring(0, 9).equals("Everybody")) {

sendToAll(pMessage);

}

System.out.println("Server hat Nachricht \"" + pMessage + "\" vom Client " + pClientIP + ":" + pClientPort + " empfangen.");

send(pClientIP, pClientPort, "Antwort vom DBG-ECHO-Server: Deine Nachricht lautete \"" + pMessage + "\".");

System.out.println("Server hat Nachricht \"" + pMessage + "\" an Client " + pClientIP + ":" + pClientPort + " zurückgesendet.");

//sendToAll(pMessage);

//closeConnection(pClientIP, pClientPort);

}

public void processClosingConnection(String pClientIP, int pClientPort) {

}

public void privateMessage(String pClientIP, int pClientPort, String pMessage) {

if (pMessage.substring(0, 9).equals(pClientIP)) {

System.out.println("User schrieb

send(pMessage);

}

}

public String getIP() {

try {

String ipAdresse = "" + InetAddress.getLocalHost();

String[] hostUndIP = ipAdresse.split("/");

String adressat = hostUndIP[0].trim();

ipAdresse = hostUndIP[1];

return ipAdresse;

}

catch (UnknownHostException e) {

e.printStackTrace();

Java, Code, Programmiersprache, Algorithmus
Wie klicke ich auf diese Elemente mit Python und Selenium?

Hallo,

Ich versuche, auf die folgenden Elemente auf dieser Webseite (https://www.bing.com/search?q=Bing+AI&showconv=1&FORM=hpcodx) mit Python und Selenium zu klicken.

//*[@id=“tone-options”]/li[3]/button

//*[@id=“camera-container”]/button

//*[@id=“camera-container”]/cib-flyout/cib-visual-search//div[3]/button[1]

Ich habe XPATH, CSS probiert.

Fehler:

selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="tone-options"]/li[3]/button"}

 (Session info: chrome=119.0.6045.200)

Stacktrace:

GetHandleVerifier [0x00007FF7D97B82B2+55298]

(No symbol) [0x00007FF7D9725E02]

(No symbol) [0x00007FF7D95E05AB]

(No symbol) [0x00007FF7D962175C]

(No symbol) [0x00007FF7D96218DC]

(No symbol) [0x00007FF7D965CBC7]

(No symbol) [0x00007FF7D96420EF]

(No symbol) [0x00007FF7D965AAA4]

(No symbol) [0x00007FF7D9641E83]

(No symbol) [0x00007FF7D961670A]

(No symbol) [0x00007FF7D9617964]

GetHandleVerifier [0x00007FF7D9B30AAB+3694587]

GetHandleVerifier [0x00007FF7D9B8728E+4048862]

GetHandleVerifier [0x00007FF7D9B7F173+4015811]

GetHandleVerifier [0x00007FF7D98547D6+695590]

(No symbol) [0x00007FF7D9730CE8]

(No symbol) [0x00007FF7D972CF34]

(No symbol) [0x00007FF7D972D062]

(No symbol) [0x00007FF7D971D3A3]

BaseThreadInitThunk [0x00007FF8125E7344+20]

RtlUserThreadStart [0x00007FF8130026B1+33]

kann mir jemand helfen? Danke.

HTML, Webseite, CSS, HTML5, Code, PHP, Programmiersprache, Python, Webdesign, Webentwicklung, Frontend, Python 3, Selenium
Ist das ein gutes Programm für String Suche in einer Datei (Java)?
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;

public class StringSearchInFile {

    public static void main(String[] args) {
        String filePath = "text.txt"; // Pfad zur Textdatei
        String searchString = "gesuchterString"; // Der zu suchende String

        try {
            FileInputStream fis = new FileInputStream(filePath);
            InputStreamReader isr = new InputStreamReader(fis);
            BufferedReader br = new BufferedReader(isr);

            String line;
            int lineNumber = 1;
            boolean found = false;
            while ((line = br.readLine()) != null) {
                if (line.contains(searchString)) {
                    System.out.println("String gefunden in Zeile " + lineNumber + ": " + line);
                    found = true;
                    break; // Abbruch nach dem ersten Fund
                }
                lineNumber++;
            }

            if (!found) {
                System.out.println("String nicht gefunden.");
            }

            br.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

Als Lösung für ein Übungsbeispiel. Es soll das erste Vorkommen eines Text in einer Datei gefunden werden.

Java, Code, Programmiersprache
wie kann man das beheben?

sidebar.css.sidebar {
    position: fixed;
    top: 0;
    right: -300px;
    width: 300px;
    height: 100%;
    background-color: #333;
    transition: right 0.3s ease; 
  }
  
  .sidebar-open {
    right: 0;
  }

.sidebar ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #333;
    position: relative;
}


.sidebar li {
    float: left;
  }

.sidebar li a {
    display: block;
    color: white;
    text-align: center;
    padding: 14px 16px;
    text-decoration: none;
}
  
.sidebar li a:hover {
    background-color: #111;
}

 

  private.php

<?php
session_start();
if(!isset($_SESSION["username"])){
  header("Location: index.php");
  exit;
}
$username = $_SESSION["username"];
 ?>
<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    
    <!-- Import Styles -->
    <link rel="stylesheet" href="cnd/css/loader.css">
    <link rel="stylesheet" href="cnd/css/container.css">
    <link rel="stylesheet" href="cnd/css/color-changer.css">
    <link rel="stylesheet" href="cnd/css/background.css">
    <link rel="stylesheet" href="cnd/css/navbar.css">
    <link rel="stylesheet" href="cnd/css/sidebar.css">
    
    <title>Your Personal Site</title>

    <!-- import scripts -->
    <script src="cnd/js/sidebar.js"></script>
    <script src="cnd/js/loader.js"></script>

    <script>
        
        const imageFiles = [
            'baldur.jpg',
            'baldur2.jpg',
            'baldur3.jpg',
            
        ];

        
        function setRandomImage() {
            const randomIndex = Math.floor(Math.random() * imageFiles.length);
            const randomImage = imageFiles[randomIndex];
            const imgElement = document.querySelector('.random-img');
            imgElement.src = `/personal-site/images/${randomImage}`; 
        }

        
       
    </script>
    <script>
        

        function setColor(color) {
            document.body.style.backgroundColor = color;
        }

        
    </script>


  </head>
  <body>
    
  <div class="loader"></div>
  
  <div class="container">
      <h1>Hallo <?php echo $username?></h1>
      <img src="" alt="random image of my dog" width="900px" height="900px" class="random-img">
      
    <script>
      setRandomImage();
    </script>
    <style>
      .dropdown {
        position: relative;
        display: inline-block;
      }

      .dropdown-content {
        display: none;
        position: absolute;
        background-color: #f9f9f9;
        min-width: 160px;
        box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
        padding: 12px 16px;
        z-index: 1;
      }

      .dropdown:hover .dropdown-content {
          display: block;
      }

    </style>
    

  </div>
  
  <div class="dropdown">
    <span>Change Color</span>
    <div class="dropdown-content">
      <div class="color-changer">
        <button onclick="setColor('green')" class="button-green">Green</button>
        <button onclick="setColor('red')" class="button-red">Red</button>
        <button onclick="setColor('blue')" class="button-blue">Blue</button>
      </div>
    </div>
    </div>
    
    <div class="navbar">
      <ul>
        <li>
          <a href="index.php">Home</a>
        </li>
        <li>
          <a href="games.php">Games</a>
        </li>
        <li class="account-dropdown">
          <a href="">Account
      </li> 
      </ul>
    </div>

    <div class="sidebar" id="sidebar">
      <ul>


        <li>
          <a href="">Home</a><br>
        </li>

        <li>
          <a href="">Pricing</a><br>
        </li>

        <li>
          <a href="">Settings</a><br>
        </li>
      </ul>
    </div>

  </body>
</html>
Bild zum Beitrag
Homepage, HTML, Webseite, CSS, JavaScript, HTML5, Code, PHP, Programmiersprache, Webdesign, Webentwicklung, Frontend, Visual Studio Code
javascript hilfe dringendd?

Hallo zusammen!

Ich habe angefangen eine ToDoListe zu machen und bin schon fast fertig. Allerdings muss ich noch zwei Buttons fertigen und ich weiss nicht wie. Das erste Button ist "Delete All", dieser sollte alle Aufgaben (Aufgaben der ToDoListe) löschen. Das zweite ist "Change Status", dieser sollte, sofort alle Aufgaben wegstreichen oder zeigen dass diese Aufgaben gemacht worden sind. Ich hoffe auf eure Hilfen!

Bin schon richtig müde, und muss die Aufgaben schon bis morgen abschicken..

Dankeschön im Voraus!

LG

const todoInput = document.querySelector(".todo-input");
const todoInputTwo = document.querySelector(".todo-input-two")
const todoButton = document.querySelector(".todo-button");
const todoList = document.querySelector(".todo-list");
const filterOption = document.querySelector(".filter-todo");
const deleteAllTodos = document.querySelector(".deleteAll button")


document.addEventListener("DOMContentLoaded", getLocalTodos);
todoButton.addEventListener("click", addTodo);
todoList.addEventListener("click", deleteCheck);
filterOption.addEventListener("change", filterTodo);


function addTodo(event) {
    event.preventDefault();
    const todoDiv = document.createElement("div");
    todoDiv.classList.add("todo");
    const newTodo = document.createElement("li");
    newTodo.innerText = `${todoInput.value}, Date: ${todoInputTwo.value}`; 
    newTodo.classList.add("todo-item");
    todoDiv.appendChild(newTodo);
+
    saveLocalTodos(todoInput.value);
    
    const completedButton = document.createElement("button");
    completedButton.innerHTML = '<i class="fas fa-check-circle"></li>';
    completedButton.classList.add("complete-btn");
    todoDiv.appendChild(completedButton);


    const trashButton = document.createElement("button");
    trashButton.innerHTML = '<i class="fas fa-trash"></li>';
    trashButton.classList.add("trash-btn");
    todoDiv.appendChild(trashButton);
    
    todoList.appendChild(todoDiv);
    todoInput.value = "";
}


function deleteCheck(e) {
    const item = e.target;


    if(item.classList[0] === "trash-btn") {
        const todo = item.parentElement;
        todo.classList.add("slide");


        removeLocalTodos(todo);
        todo.addEventListener("transitionend", function() {
            todo.remove();
        });
    }


    if(item.classList[0] === "complete-btn") {
        const todo = item.parentElement;
        todo.classList.toggle("completed");
    }
}


function filterTodo(e) {
    const todos = todoList.childNodes;
    todos.forEach(function(todo) {
        switch(e.target.value) {
            case "all": 
                todo.style.display = "flex";
                break;
            case "completed": 
                if(todo.classList.contains("completed")) {
                    todo.style.display = "flex";
                } else {
                    todo.style.display = "none";
                }
                break;
            case "incomplete":
                if(!todo.classList.contains("completed")) {
                    todo.style.display = "flex";
                } else {
                    todo.style.display = "none";
                }
                break;
        }
    });
}


function saveLocalTodos(todo) {
    let todos;
    if(localStorage.getItem("todos") === null) {
        todos = [];
    } else {
        todos = JSON.parse(localStorage.getItem("todos"));
    }
    todos.push(todo);
    localStorage.setItem("todos", JSON.stringify(todos));
}


function getLocalTodos() {
    let todos;
    if(localStorage.getItem("todos") === null) {
        todos = [];
    } else {
        todos = JSON.parse(localStorage.getItem("todos"));
    }
    todos.forEach(function(todo) {
        const todoDiv = document.createElement("div");
        todoDiv.classList.add("todo");
        const newTodo = document.createElement("li");
        newTodo.innerText = todo;
        newTodo.classList.add("todo-item");
        todoDiv.appendChild(newTodo);


        const completedButton = document.createElement("button");
        completedButton.innerHTML = '<i class="fas fa-check-circle"></li>';
        completedButton.classList.add("complete-btn");
        todoDiv.appendChild(completedButton);


        const trashButton = document.createElement("button");
        trashButton.innerHTML = '<i class="fas fa-trash"></li>';
        trashButton.classList.add("trash-btn");
        todoDiv.appendChild(trashButton);


        todoList.appendChild(todoDiv);
    });
}


function removeLocalTodos(todo) {
    let todos;
    if(localStorage.getItem("todos") === null) {
        todos = [];
    } else {
        todos = JSON.parse(localStorage.getItem("todos"));
    }



  deleteAllTodos.addEventListener("click", removeAllTodos);



    const todoIndex = todo.children[0].innerText;
    todos.splice(todos.indexOf(todoIndex), 1);
    localStorage.setItem("todos", JSON.stringify(todos));
}

HTML, Webseite, CSS, JavaScript, HTML5, Code, Programmiersprache, Webentwicklung, Frontend
Wie kann ich die Reihenfolge der Hintergrundfarben ändern?

Hallo zusammen!

ich mache gerade die Hausaufgaben in IT aber ich komme leider nicht weiter.

Wie ihr auf dem Foto bereits seht, habe ich zwei Hintergründe.

Aber das Problem ist, dass der erste Hintergrund unten sein soll und der zweite Hintergrund, der gerade unten ist, soll nach oben kommen. Also einfach gesagt, ich möchte die Reihenfolge der Hintergrundfarben ändern. Ich habe schon wirklich lange daran gesessen.

Ich weiß nicht, wie man es weiter macht. Könnte mir bitte jemand helfen?

P.S. JavaScript passt leider nicht in die Frage hinein. Ihr findet es in den Kommentaren!

Dankeschön im Voraus.

LG!

Übrigens, hier die Codes:

HTML:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>My Tasks</title>
  <link rel="stylesheet" href="./style.css">
  <script defer src="./script.js"></script>
</head>
<body>
  <div class="bodyDiv">
  <header>
    <div class="title">
      <h1>My Tasks</h1>
    </div>
  </header>
  <main>
    <section>
      <div class="inputs">
        <input id="inputOne" type="text" placeholder="Enter your task!">
        <input id="inputTwo" type="date" placeholder="Enter your date!">
        <button id="buttonForInputs">Add task!</button>
      </div>
    </section>
    <section>
      <div class="tasks">
        <div class="date"> 
          <div class="information"></div>
        </div>
      </div>
    </section>    
   <section>
    <div class="buttons">
      <button id="buttonOne">Delete all!</button>
      <button>Change status!</button>
    </div>
   </section>
  </main>
  </div>
</body>
</html>

CSS:

* {
  margin: 0;
  box-sizing: border-box;
}


/*BODY_AND_HTML*/
html {
background-image: linear-gradient(161deg, rgba(117, 117, 117, 0.03) 0%, rgba(117, 117, 117, 0.03) 50%,rgba(8, 8, 8, 0.03) 50%, rgba(8, 8, 8, 0.03) 100%),linear-gradient(59deg, rgba(245, 245, 245, 0.05) 0%, rgba(245, 245, 245, 0.05) 50%,rgba(68, 68, 68, 0.05) 50%, rgba(68, 68, 68, 0.05) 100%),linear-gradient(286deg, rgba(107, 107, 107, 0.07) 0%, rgba(107, 107, 107, 0.07) 50%,rgba(7, 7, 7, 0.07) 50%, rgba(7, 7, 7, 0.07) 100%),linear-gradient(123deg, rgba(9, 9, 9, 0.09) 0%, rgba(9, 9, 9, 0.09) 50%,rgba(120, 120, 120, 0.09) 50%, rgba(120, 120, 120, 0.09) 100%),linear-gradient(170deg, rgba(202, 202, 202, 0.01) 0%, rgba(202, 202, 202, 0.01) 50%,rgba(19, 19, 19, 0.01) 50%, rgba(19, 19, 19, 0.01) 100%),linear-gradient(210deg, rgba(64, 64, 64, 0.04) 0%, rgba(64, 64, 64, 0.04) 50%,rgba(4, 4, 4, 0.04) 50%, rgba(4, 4, 4, 0.04) 100%),linear-gradient(90deg, rgb(249, 17, 190),rgb(100, 28, 213));
background-repeat: no-repeat;
background-size: cover;
height: 1000px;
}

/*HEADER*/

header .title {
  display: flex;
  justify-content: center;
}


header h1 {
  font-size: 4rem;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  color: #fff;
}

/*MAIN*/

.tasks {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 50px;
}

.tasks .date .information p {
  margin-top: -210px;
  margin-left: -190px;
  color: #fff;
  font-weight: 100;
  font-size: 15px;
  font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
}

.tasks .date {
  background-color: orange;
  width: 20%;
  padding-bottom: 20px;
  border-radius: 9px;
  display: none;  
}

.tasks .date .information {
  background-color: rgb(219, 182, 112);
  padding-top: 220px;
  border-radius: 5px;
  text-align: start;
  display: none;
}

.tasks .date p {
  text-align: center;
  color: #fff;
  font-weight: 700;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

.inputs {
 display: flex;
 justify-content: center;
 flex-direction: column;
 align-items: center;
}

.inputs input {
  width: 30%;
  height: 30px;
  border-radius: 7px;
}

.inputs #inputOne {
  margin-top: 150px;
}

.inputs #inputTwo {
  margin-top: 10px;
}

.inputs button {
  margin-top: 15px;
  width: 8%;
  height: 30px;
  margin-right: 320px;
  border-radius: 10px;
  color: #fff;
  font-weight: 600;
  background-image: linear-gradient(353deg, rgb(242, 82, 69),rgb(131, 28, 80));
  text-transform: uppercase;
  cursor: pointer;
  border: none;
}

.buttons {
  display: flex;
  justify-content: center;
  margin-right: 150px;
  margin-top: 30px;
  gap: 10px;
}

.buttons button {
  width: 11%;
  height: 30px;
  border-radius: 10px;
  color: #fff;
  font-weight: 600;
  background-image: linear-gradient(353deg, rgb(242, 82, 69),rgb(131, 28, 80));
  text-transform: uppercase;
  cursor: pointer;
  border: none;
}
Bild zum Beitrag
HTML, Webseite, CSS, JavaScript, HTML5, Code, Programmiersprache, Webdesign, Webentwicklung, Frontend, Visual Studio Code
Sticky navbar funktioniert nicht?

Guten Tag, ich muss für die Schule eine Webseite erstellen und wollte eine Sticky navbar einfügen. Dabei soll der untere Teil mit La Petite France, Cathédrale, rivière kleben bleiben. Kann mir jemand helfen?

<script>
        window.onscroll = function() {myFunction()};

        var navbar = document.getElementById("navbar");
        var sticky = navbar.offsetTop;

        function myFunction() {
        if (window.pageYOffset >= sticky) {
        navbar.classList.add("sticky")
    } else {
        navbar.classList.remove("sticky");
    }
    }
</script>
<header>
    <section class="hero is-medium">
        <div class="hero-head">
            <nav class="navbar">
                <div class="container">
                    <div class="navbar-brand">
                        <a class="navbar-item" href="index.html">
                            <img src="cigogne_strasbourg.png" alt="Logo">
                        </a>
                        <span class="navbar-burger" data-target="navbarMenuHeroB">
                            <span></span>
                            <span></span>
                            <span></span>
                      </span>
                    </div>
                    <div id="navbarMenuHeroB" class="navbar-menu">
                        <div class="navbar-end">
                            <a class="navbar-item is-active" href="index.html">
                                Home
                            </a>
                            <a class="navbar-item" href="details.html">
                                Y arriver
                            </a>
                            <a class="navbar-item" href="anmeldung.html">
                                Composer ses vacances
                            </a>
                            <span class="navbar-item">
                              <a class="button is-info is-inverted">
                                <!--<span class="icon">
                                  <i class="fab fas fa-fingerprint"></i>
                                </span>-->
                                <span>Einloggen</span>
                              </a>
                            </span>
                        </div>
                    </div>
                </div>
            </nav>
        </div>
        <div class="hero-body">
            <div class="tile is-ancestor">
                <div class="tile is-parent">
                    <div class="tile is-child is-4 is-align-content-end">
                        <h1 class="title is-2">Strasbourg</h1>
                        <h2 class="subtitle is-4">La P'tit Venise</h2>
                    </div>
                    <div class="tile is-child is-8">
                        <figure class="image">
                            <img width="10" src="cathedralefenetre.jpg" alt="Fenêtre"/>
                        </figure>
                    </div>
                </div>
            </div>
        </div>



<div id="navbar">
            <nav class="tabs is-boxed is-fullwidth">
                <div class="container">
                    <ul>
                        <li class="is-active">
                            <a href="javascript:void(0)">La Petite France</a>
                        </li>
                        <li>
                            <a href="javascript:void(0)">La Cathédrale Notre-Dame</a>
                        </li>
                        <li>
                            <a href="javascript:void(0)">La rivière</a>
                        </li>
                    </ul>
                </div>
            </nav>
</div>

    </section>
</header>

CSS:

.content {
    padding: 16px;
}
.sticky {
    position: fixed;
    top: 0;
    width: 100%;
}
.sticky + .content {
    padding-top: 60px;
}
Bild zum Beitrag
HTML, Webseite, CSS, JavaScript, HTML5, Code, Programmiersprache, Webdesign, Webentwicklung
python - dict -Iterite nicht durch?

dict

 {"26-11-2023": {"1": {"enos": {"infinitivee": "enormous", "k": "b"}},"25-11-2023": {"1": {"enor": {"infinitivee": "enormous", "k": "b"}}}}}

code:

def read_json():
    daters = []
    # sefly read json file
    try:
        with open('German-English_wordlist.json', 'r', encoding="utf-8-sig") as f:
            data = json.load(f)
    except json.decoder.JSONDecodeError:
        print("\033[91m[!!] File empty or anything wrong in file\033[0m", end=" - ")
        print("\033[93mTry running `add` command\033[0m", end="\n")
        return
    except FileNotFoundError:
        print("\033[91m[!!] File not found\033[0m", end=" - ")
        print("\033[93mTry running `add` command to create\033[0m", end="\n")
        return
    except Exception:
        print("\033[91m[!!]Unknown error \033[0m", end=" - ")
        print("\033[93mTry to report\033[0m", end="\n")
        print(Exception)
        return
    # check valid vocabulary daters
    #KeyError: '25-11-2023'
    try:
        for key in data.keys():
            print(data)
            print(data['25-11-2023'])
            print(key)
            if timestamp >= int(datetime.datetime.strptime(key, '%d-%m-%Y').strftime("%s")) and timestamp != "---":
                daters.append(key)

    except UnboundLocalError:
        print("\033[91m[!!] File empty or anything wrong in file\033[0m", end=" - ")
        print("\033[93mTry running `add` command\033[0m", end="\n")
        return
    # if not a dater in then print finish and break else choice random on of them
    print(daters)
    try:
        dater = random.choice(daters)
    except IndexError:
        print("\033[93mFinish\033[0m\n")
        return

    queried = [key for key in data[dater].keys()]
    queried = random.choice(queried)
    keys = [key for key in data[dater][queried].keys()]
    key = random.choice(keys)
    forms = [key for key in data[dater][queried][key].keys()]

    # depending on the mode asking for the form of the word
    if False:
        form = random.choice(forms)
    else:
        form = "infinitivee"

    value = data[dater][queried][key][form]

    return data, dater, queried, key, form, value

output:

{'26-11-2023': {'1': {'enos': {'infinitivee': 'enormous', 'k': 'b'}}, '25-11-2023': {'1': {'enor': {'infinitivee': 'enormous', 'k': 'b'}}}}}
Traceback (most recent call last):
  File "/media/deffer/User_data/Tools/vokabularis/vokabularis.py", line 135, in <module>
    data, choused_dater, queried, key, form, value = read_json()
  File "/media/deffer/User_data/Tools/vokabularis/vokabularis.py", line 44, in read_json
    print(data['25-11-2023'])
KeyError: '25-11-2023'

Wenn ich mein dictionary zum volgendem andere, funktioniert alles.

{"25-11-2023": {"1": {"enor": {"infinitivee": "enormous", "k": "b"}}}, "26-11-2023": {"1": {"enos": {"infinitivee": "enormous", "k": "b"}}}}

code:

ist der selbe wie davor

Output:

Successed
Code, Error, Python 3
Wie korrigiere ich meinen CountSort-Code, damit er absteigend sortiert?

Hallo!

Meine Aufgabe: Ich soll eine Count Sort implementieren, und zwar so, dass man beim Programm aufrufen im Argument auswählen kann, ob das Array aufsteigend oder absteigend sortiert werden soll.

Mein Problem: Das Aufsteigen sortieren funktioniert, aber das Absteigen sortiert ebenfalls aufsteigend, obwohl es absteigend sortieren soll.

Meine Annahmen: Eigentlich gehe ich davon aus, dass meine Funktion "count_sort_write_output_array", welche das sortierte Array basierend auf der angegebenen Sortierrichtung erstellt, korrekt ist. Schließlich ist es einfach der gleiche Code wie für ASCENDING (aufsteigend), bloß mit geringfügigen Änderungen.

Ich denke eher, dass es daran liegt, dass mein Code erst gar nicht DESCENDING (absteigend) 'auswählt', wenn "desc" als Argument gegeben wird. Ich habe als Standardverhalten ASCENDING gesetzt (also falls kein Argument gegeben wird, oder ein falsches Argument gegeben wird, wird es aufsteigend sortiert), also dachte ich vielleicht, dass entweder

if (strcmp(order, "asc") == 0)

oder

else if (strcmp(order, "desc") == 0)

(in der SortDirection Funktion) irgendwie "falsch" sind, sodass die Sortierfunktion immer das Standardverhalten auswählt. (Also ASCENDING)

Als Debug-Versuch habe ich:

printf("Sortdirection must be defined. Using default: ASCENDING\n");

eingefügt, um zu schauen ob das wirklich der Fall ist. Dennoch wird dieser printf nie gezeigt, selbst wenn ich kein Argument eingebe. Was mich ziemlich verwirrt. Bricht es vorher ab?

Meine 'Frage' an euch: Ich würde es sehr schätzen, wenn jemand einen Blick darauf werfen könnte. Eventuell kann jemand erkennen, woran mein Semantikfehler liegt.

Aber würde ich es auch schätzen, wenn mir jemand andere Debug-Ideen nennen könnte. Ich habe noch nicht viel mit 'Debugging-Methoden' beschäftigt und habe meine Probleme bisher größtenteils mit printfs gelöst. Aber vielleicht gibt es da etwas leichteres!

Vielen Dank!

Bild zum Beitrag
Computer, programmieren, Code, Informatik, Programmiersprache, Visual Studio, Algorithmus, debugging, Sortieralgorithmus
Wie kann ich für ein dynamisches Vier gewinnt eine Gewinnabfrage erstellen?

Hallo,

ich frage mich, wie ich für ein dynamisches Vier gewinnt eine Gewinnabfrage erstellen kann.

Mein aktueller Code (ohne Klassen für Grafik) sieht so aus:

using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media.Animation;
using System.Windows.Threading;

namespace N_Gewinnt_Mölleken
{
  public partial class MainWindow : Window
  {
    Linie linie;
    Chip chip;
    private bool isHorizontalMoveEnabled = true;
    int anzahlspalten = 40;
    int anzahlzeilen = 9;
    int BallColor = 1;
    int GewinnMenge = 4;
    DispatcherTimer timer;
    Double ticks_old;
    int Spieler = 1;
    Double BRadius;
    Double BallX;
    Double AktuellX = 0;
    int NichtAus;
    private bool isLeftKeyPressed = false;
    private bool isRightKeyPressed = false;
    int count = 0;
    int[,] BallPosition;

    public MainWindow()
    {
      InitializeComponent();
      BallPosition = new int[anzahlspalten, anzahlzeilen];
    }

    private void wnd_Loaded(object sender, RoutedEventArgs e)
    {
      this.WindowState = WindowState.Maximized;
      InitializeGame();
    }

    private void InitializeGame()
    {
      timer = new DispatcherTimer();
      timer.Tick += timer_Tick;
      timer.Interval = new TimeSpan(0, 0, 0, 0, 15);
      timer.Start();
      double screenwidth = SystemParameters.PrimaryScreenWidth;
      double screenheight = SystemParameters.PrimaryScreenHeight;
      double x1 = screenwidth - (screenwidth * 0.3), y1 = screenheight - (screenheight * 0.10), x2 = x1, y2 = screenheight - (screenheight * 0.9);

      for (int spalten = 0; spalten <= anzahlspalten; spalten++)
      {
        linie = new Linie(x1, y1, x2, y2);
        linie.Draw(cvs);
        x1 -= ((screenwidth - (screenwidth * 0.3)) / anzahlspalten);
        x2 = x1;
      }

      linie = new Linie(screenwidth * 0.7, screenheight * 0.9, x1 + ((screenwidth - (screenwidth * 0.3)) / anzahlspalten), screenheight * 0.9);
      linie.Draw(cvs);
      BRadius = ((screenwidth - 4 - (screenwidth * 0.3)) / anzahlspalten) / 2;
      BallX = ((screenwidth - (screenwidth * 0.3)) / anzahlspalten) / 2;
      chip = new Chip(BallX, 130, BRadius, 0, 0, Spieler);
      chip.Draw(cvs);
    }

    private void timer_Tick(object sender, EventArgs e)
    {
      Double ticks = Environment.TickCount;

      if (ticks_old == 0)
      {
        ticks_old = ticks;
        return;
      }

      double elapsed = (ticks - ticks_old);
      ticks_old = ticks;
    }

    private void wnd_KeyDown(object sender, KeyEventArgs e)
    {
      if (e.Key == Key.Left)
      {
        MoveBallLeft();
      }
      else if (e.Key == Key.Right)
      {
        MoveBallRight();
      }

      if (e.Key == Key.Down)
      {
        MoveBallDown();
      }
    }

    private void MoveBallRight()
    {
      if (isHorizontalMoveEnabled && count < anzahlspalten - 1)
      {
        AktuellX = AktuellX + BallX;
        Canvas.SetLeft(chip.Elli, AktuellX * 2);
        count += 1;
      }
    }

    private void MoveBallLeft()
    {
      if (isHorizontalMoveEnabled && count > 0)
      {
        AktuellX = AktuellX - BallX;
        Canvas.SetLeft(chip.Elli, AktuellX * 2);
        count -= 1;
      }
    }

    // ...

    private void MoveBallDown()
    {
      NichtAus = 0;

      for (int i = 0; i < anzahlzeilen; i++)
      {
        if (BallPosition[count, i] == 0)
        {
          BallPosition[count, i] = Spieler;
          // Logik für die Darstellung des Chips
          MessageBox.Show("ChipPlatziert");
          NichtAus = 1;
          MessageBox.Show($"Chip an Position ({count}, {i}) platziert. Wert im Array: {BallPosition[count, i]}");
          
          break;
        }
        MessageBox.Show("EineZeileBlockiert");
      }

      if (NichtAus == 0)
      {
        MessageBox.Show("Sie können in dieser Zeile nicht platzieren");
      }

      if (Spieler == 1)
      {
        Spieler = -1;
      }
      else if (Spieler == -1)
      {
        Spieler = 1;
      }
    }    
  }
}
C Sharp, Code, Programmiersprache, Algorithmus
Frage zu Array in ein Model schreiben?

Ich möchte gerne ein array

array(1) { [0]=> object(App\Content\ContentModel)#24 (17) { ["id"]=> int(1) ["title"]=> string(7) "Healing" ["sub_title"]=> string(0) "" ["content"]=> string(0) "" ["sub_content"]=> string(0) "" ["offer1_time"]=> string(0) "" ["offer1_price"]=> string(0) "" ["offer2_time"]=> string(0) "" ["offer2_price"]=> string(0) "" ["offer_extension_time"]=> string(0) "" ["offer_extension_price"]=> string(0) "" ["image"]=> string(35) "pexels-arina-krasnikova-6997996.jpg" ["parent"]=> int(1) ["sequence"]=> int(1) ["link"]=> string(2) "15" ["button_text"]=> string(11) "Zum Angebot" ["module"]=> string(0) "" } }

das ich aus der Datenbank erhalte über ein repository in ein model speichern damit ich mehrere datensätze zu einem Modul hinzufügen kann, nun wirft es mir aber eine fehlermeldung an und ich komm einfach nicht weiter.

Hier das repository:

    public function fetchModulesForPage(int $pageId): array
    {
        $stmt = $this->pdo->prepare('SELECT modules.* FROM modules JOIN pages ON modules.parent = pages.id WHERE pages.id = :pageId');
        $stmt->bindValue(':pageId', $pageId);
        $stmt->fetchAll(PDO::FETCH_CLASS, ModulesModel::class);
        $stmt->execute();
        $modules = $stmt->fetch();



        $contentRepository = new ContentRepository($this->pdo);


        foreach ($modules as $module) {


        $moduleContent = $contentRepository->fetchContentForModule($module);
        $module->setContent($moduleContent);
        }
            return $modules;
        }

und hier das Model:

<?php


namespace App\Modules;


class ModulesModel
{


    public int $id;
    public string $title;
    public int $parent;
    public string $module;
    public int $sequence;
    public array $content = [];


    public function setContent(array $content): void
    {
        $this->content = $content;
    }
}

die fehlermeldung ist:

Fatal error: Uncaught Error: Call to a member function setContent() on int in C:\xampp\htdocs\test\src\Modules\ModulesRepository.php:29 Stack trace: #0 C:\xampp\htdocs\test\src\Controller\PagesController.php(61): App\Modules\ModulesRepository->fetchModulesForPage(6) #1 C:\xampp\htdocs\test\index.php(73): App\Controller\PagesController->getAllContentFromModules(6) #2 {main} thrown in C:\xampp\htdocs\test\src\Modules\ModulesRepository.php on line 29

die line 29 ist folgende:

$module->setContent($moduleContent);
Array, Code, MySQL, PHP, Programmiersprache
html Widget programmieren mit Django Datenbank?

Hallo,

ich habe eine Django Datenbank erstellt, und möchte mein html Widget für meine Webseite damit verwalten. Die Datenbank funktioniert soweit, ich kann Datensätze hinzufügen, bearbeiten und entfernen. Wenn ich den Link in den Browser eingebe wird meine Tabelle im Browser auch mit allen Daten angezeigt und aktualisiert wenn ich in der Datenbank etwas ändere. Bette ich den html code nun aber in meine Webseite ein, wird die Tabelle angezeigt, aber ohne den Inhalten aus der Datenbank. Kann mir bei dem Problem vielleicht jemand helfen.

Vielen Dank schonmal im Voraus.

Das ist der html Code:

<!DOCTYPE html>
<html>
<head>
  <style>
    /* Stil für die gesamte Tabelle */
    table {
      border-collapse: collapse;
      width: 65%;
      margin: 20px auto;
      border: 1px solid #ccc;
      position: relative;
    }
    th, td {
      text-align: left;
      padding: 8px;
      border-right: 1px solid #ccc;
    }
    th {
      background-color: #8B0000;
      color: white;
      text-align: left;
    }
    tr:nth-child(even) {
      background-color: #f2f2f2;
    }
    tr:nth-child(odd) {
      background-color: #ffffff;
    }
    td:last-child {
      border-right: none;
    }
    th:nth-child(1), td:nth-child(1),
    th:nth-child(4), td:nth-child(4) {
      width: 100px;
    }
    td:nth-child(2), th:nth-child(2),
    td:nth-child(3), th:nth-child(3) {
      width: 85px;
    }
    h1 {
      text-align: center;
    }
  </style>
</head>
<body>
  <h1>Nächste Veranstaltungen</h1>
  <table>
    <tr>
      <th>Titel</th>
      <th>Datum</th>
      <th>Zeitraum</th>
      <th>Örtlichkeit</th>
    </tr>
    <!-- Schleife für die Anzeige der nächsten drei Veranstaltungen -->
    {% for event in upcoming_events %}
    <tr>
      <td>{{ event.Titel }}</td>
      <td>{{ event.Datum|date:"l, j. F Y" }}</td>
      <td>{{ event.Zeitraum }}</td>
      <td>{{ event.Örtlichkeit }}</td>
    </tr>
    {% endfor %}
  </table>
</body>
</html>

Bild zum Beitrag
HTML, Webseite, HTML5, Code, Programmiersprache, Webdesign, Webentwicklung

Meistgelesene Fragen zum Thema Code