Untitled

mail@pastecode.io avatar
unknown
plain_text
5 months ago
1.2 kB
0
Indexable
<!-- Second Page to Display Selected Character and Username -->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Game Page</title>
    <style>
        /* Add your CSS styles here */
    </style>
</head>
<body>
    <div>
        <img id="selectedCharacterImage" src="" alt="Selected Character">
        <h2 id="username">Username Here</h2>
    </div>

    <script>
        const selectedCharacter = localStorage.getItem('selectedCharacter');
        const username = localStorage.getItem('username');

        const characterImgElement = document.getElementById('selectedCharacterImg');
        const usernameElement = document.getElementById('username');

        if (selectedCharacter) {
            characterImgElement.src = selectedCharacter;
        } else {
            characterImgElement.alt = "Character Image Not Found";
        }

        if (username) {
            usernameElement.innerText = username;
        } else {
            usernameElement.innerText = "Username Not Found";
        }
    </script>
</body>
</html>
Leave a Comment