Friday, December 29, 2023

Write 10 To100 prompts for text based AI websites for Generating multiple HTML tool

Write 10 To100 prompts for text based AI websites for Generating multiple HTML tool


A creative assistant for generating and refining images



Memory Game:

1. Write a responsive code for a Memory Game using HTML, CSS, and JavaScript. Include a grid of cards that users can flip to match pairs.

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Memory Game</title> <style> body { display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; background-color: #f0f0f0; } #memory-game { display: grid; grid-template-columns: repeat(4, 100px); gap: 10px; } .card { width: 100px; height: 100px; display: flex; justify-content: center; align-items: center; font-size: 1.5rem; font-weight: bold; cursor: pointer; background-color: #ddd; border-radius: 5px; transition: transform 0.3s ease-in-out; } .card.flipped { transform: rotateY(180deg); } .card.matched { background-color: #8aff8a; cursor: default; } </style> </head> <body> <div id="memory-game"></div> <script> document.addEventListener('DOMContentLoaded', function () { const cards = ['A', 'A', 'B', 'B', 'C', 'C', 'D', 'D', 'E', 'E', 'F', 'F', 'G', 'G', 'H', 'H']; let flippedCards = []; let matchedCards = []; const memoryGame = document.getElementById('memory-game'); // Shuffle the cards array cards.sort(() => Math.random() - 0.5); // Create card elements and add to the game board cards.forEach((card, index) => { const cardElement = document.createElement('div'); cardElement.classList.add('card'); cardElement.dataset.card = card; cardElement.addEventListener('click', flipCard); memoryGame.appendChild(cardElement); }); function flipCard() { if (flippedCards.length < 2 && !this.classList.contains('flipped') && !this.classList.contains('matched')) { this.classList.add('flipped'); flippedCards.push(this); if (flippedCards.length === 2) { setTimeout(checkMatch, 500); } } } function checkMatch() { const [card1, card2] = flippedCards; if (card1.dataset.card === card2.dataset.card) { card1.classList.add('matched'); card2.classList.add('matched'); matchedCards.push(card1, card2); if (matchedCards.length === cards.length) { alert('Congratulations! You matched all the pairs!'); } } else { card1.classList.remove('flipped'); card2.classList.remove('flipped'); } flippedCards = []; } }); </script> </body> </html>

This code creates a simple memory game with a 4x4 grid of cards. You can customize the number of cards and the layout as needed. Each card has a hidden value, and the goal is to match all pairs by flipping two cards at a time. If the cards match, they stay face up; otherwise, they flip back. The game ends when all pairs are matched.

Video Background Generator:

2. Develop a responsive code for a Video Background Generator using HTML, CSS, and JavaScript. Allow users to select and preview video backgrounds for websites.

Certainly! Below is a simple example of a Video Background Generator using HTML, CSS, and JavaScript. This code allows users to select a video file and preview it as a background for a webpage.


<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Video Background Generator</title> <style> body { margin: 0; padding: 0; overflow: hidden; } #video-background { position: fixed; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; z-index: -1; } #content { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; color: #fff; } #video-input { margin-bottom: 20px; } </style> </head> <body> <input type="file" id="video-input" accept="video/*"> <video id="video-background" loop muted></video> <div id="content"> <h1>Your Website Title</h1> <p>Your website content goes here.</p> </div> <script> document.getElementById('video-input').addEventListener('change', function (e) { const videoFile = e.target.files[0]; const video = document.getElementById('video-background'); if (videoFile && video.canPlayType(videoFile.type)) { const videoURL = URL.createObjectURL(videoFile); video.src = videoURL; } }); </script> </body> </html>


In this example:

  • The video element is used to display the video as a background.
  • The input element with the type file allows users to select a video file.
  • The JavaScript code listens for changes in the file input and updates the video source accordingly.

Remember to customize the HTML content inside the #content div according to your website's needs. This is just a basic template, and you can enhance it further based on your design preferences and requirements.


Word Search Puzzle:

3. Write a complete responsive code for a Word Search Puzzle using HTML, CSS, and JavaScript. Generate a puzzle with words to find.


Sure, I can provide you with a simple example of a responsive Word Search Puzzle using HTML, CSS, and JavaScript. This example will include a predefined list of words to find in the puzzle. Here's the code;

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Word Search Puzzle</title>

    <style>

        body {

            font-family: Arial, sans-serif;

            display: flex;

            justify-content: center;

            align-items: center;

            height: 100vh;

            margin: 0;

        }


        #puzzle-container {

            display: grid;

            grid-template-columns: repeat(10, 1fr);

            gap: 5px;

            max-width: 500px;

        }


        .cell {

            width: 40px;

            height: 40px;

            border: 1px solid #ddd;

            text-align: center;

            line-height: 40px;

            font-size: 16px;

            cursor: pointer;

        }


        .word {

            color: #3498db;

            font-weight: bold;

        }

    </style>

</head>

<body>

    <div id="puzzle-container"></div>


    <script>

        // List of words to find in the puzzle

        const wordsToFind = ["javascript", "html", "css", "puzzle", "word", "search", "responsive"];


        // Function to generate a word search puzzle

        function generatePuzzle(words) {

            const gridSize = 10;

            const puzzle = [];


            // Initialize empty grid

            for (let i = 0; i < gridSize; i++) {

                puzzle[i] = Array(gridSize).fill("");

            }


            // Insert words into the grid

            words.forEach(word => {

                const direction = Math.random() < 0.5 ? "horizontal" : "vertical";

                let row = Math.floor(Math.random() * gridSize);

                let col = Math.floor(Math.random() * gridSize);


                // Check if word fits in the chosen direction

                while (!canPlaceWord(word, row, col, direction, puzzle)) {

                    row = Math.floor(Math.random() * gridSize);

                    col = Math.floor(Math.random() * gridSize);

                }


                // Place word in the grid

                placeWord(word, row, col, direction, puzzle);

            });


            return puzzle;

        }


        // Function to check if a word can be placed in the grid

        function canPlaceWord(word, row, col, direction, puzzle) {

            const gridSize = puzzle.length;

            const wordLength = word.length;


            if (direction === "horizontal" && col + wordLength <= gridSize) {

                for (let i = 0; i < wordLength; i++) {

                    if (puzzle[row][col + i] !== "") {

                        return false;

                    }

                }

                return true;

            }


            if (direction === "vertical" && row + wordLength <= gridSize) {

                for (let i = 0; i < wordLength; i++) {

                    if (puzzle[row + i][col] !== "") {

                        return false;

                    }

                }

                return true;

            }


            return false;

        }


        // Function to place a word in the grid

        function placeWord(word, row, col, direction, puzzle) {

            const wordLength = word.length;


            if (direction === "horizontal") {

                for (let i = 0; i < wordLength; i++) {

                    puzzle[row][col + i] = word[i];

                }

            }


            if (direction === "vertical") {

                for (let i = 0; i < wordLength; i++) {

                    puzzle[row + i][col] = word[i];

                }

            }

        }


        // Function to render the puzzle on the webpage

        function renderPuzzle(puzzle) {

            const puzzleContainer = document.getElementById("puzzle-container");


            puzzle.forEach(row => {

                row.forEach(cell => {

                    const cellElement = document.createElement("div");

                    cellElement.className = "cell";

                    cellElement.textContent = cell;

                    puzzleContainer.appendChild(cellElement);

                });

            });

        }


        // Generate and render the puzzle

        const puzzle = generatePuzzle(wordsToFind);

        renderPuzzle(puzzle);

    </script>

</body>

</html>

This code defines a simple word search puzzle with a 10x10 grid. The words to find are predefined, and the puzzle is generated randomly. The puzzle is then rendered on the webpage with HTML, styled with CSS, and the logic is implemented using JavaScript. You can customize the code further to add more features or make it more interactive based on your requirements.


GIF Maker:

4. Create a responsive code for a GIF Maker using HTML, CSS, and JavaScript. Allow users to upload images and create GIFs with customization options.


Sure, I can provide you with a basic example of a responsive GIF maker using HTML, CSS, and JavaScript. Note that this is a simple demonstration, and you may want to enhance and customize it further based on your specific requirements.


<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>GIF Maker</title> <style> body { font-family: Arial, sans-serif; background-color: #f4f4f4; text-align: center; } #app { max-width: 600px; margin: 50px auto; padding: 20px; background-color: #fff; border-radius: 8px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); } #preview { max-width: 100%; margin-top: 20px; } #controls { margin-top: 20px; } input[type="file"] { display: none; } label { display: inline-block; padding: 10px 15px; background-color: #3498db; color: #fff; cursor: pointer; border-radius: 4px; font-size: 16px; } #startBtn { background-color: #2ecc71; } #downloadBtn { background-color: #e74c3c; } </style> </head> <body> <div id="app"> <h1>GIF Maker</h1> <input type="file" id="fileInput" accept="image/*" multiple> <label for="fileInput">Choose Images</label> <div id="controls"> <button id="startBtn">Create GIF</button> <button id="downloadBtn" disabled>Download GIF</button> </div> <div id="preview"></div> </div> <script> document.addEventListener('DOMContentLoaded', function () { const fileInput = document.getElementById('fileInput'); const startBtn = document.getElementById('startBtn'); const downloadBtn = document.getElementById('downloadBtn'); const preview = document.getElementById('preview'); let images = []; fileInput.addEventListener('change', function (e) { images = []; const files = e.target.files; for (let i = 0; i < files.length; i++) { const reader = new FileReader(); reader.onload = function (event) { images.push(event.target.result); }; reader.readAsDataURL(files[i]); } }); startBtn.addEventListener('click', function () { if (images.length > 0) { createGIF(images); downloadBtn.removeAttribute('disabled'); } }); downloadBtn.addEventListener('click', function () { downloadGIF(); }); function createGIF(images) { // Implement GIF creation logic using a GIF library (e.g., gif.js) // This is a placeholder, and you may need to include a GIF library for this functionality. // Example: https://github.com/jnordberg/gif.js // Create and display the GIF preview. const gifPreview = document.createElement('img'); gifPreview.src = 'path/to/created/gif'; // Replace with the actual path to the created GIF. gifPreview.setAttribute('alt', 'Generated GIF'); gifPreview.setAttribute('id', 'gifPreview'); preview.innerHTML = ''; preview.appendChild(gifPreview); } function downloadGIF() { const gifPreview = document.getElementById('gifPreview'); if (gifPreview) { const link = document.createElement('a'); link.href = gifPreview.src; link.download = 'generated.gif'; link.click(); } } }); </script> </body> </html>

Note: The provided code is a basic example, and you may need to integrate a GIF creation library such as gif.js for creating GIFs. Additionally, ensure that you have the necessary libraries included and handle the server-side logic for storing and processing the images.



Calendar Countdown:

5. Develop a complete responsive code for a Calendar Countdown using HTML, CSS, and JavaScript. Display the days remaining to a specified date.


Certainly! Below is a simple example of a responsive Calendar Countdown using HTML, CSS, and JavaScript. This code calculates the days remaining until a specified date and updates the display accordingly.


<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Calendar Countdown</title> <style> body { font-family: Arial, sans-serif; background-color: #f4f4f4; text-align: center; margin: 20px; } .countdown-container { max-width: 400px; margin: 0 auto; background-color: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); } #countdown { font-size: 24px; margin-bottom: 20px; } </style> </head> <body> <div class="countdown-container"> <h2>Countdown to specified date</h2> <div id="countdown"></div> </div> <script> // Set the target date for the countdown const targetDate = new Date('2023-12-31T00:00:00').getTime(); // Update the countdown every second const countdownInterval = setInterval(updateCountdown, 1000); function updateCountdown() { const currentDate = new Date().getTime(); const timeRemaining = targetDate - currentDate; if (timeRemaining > 0) { const days = Math.floor(timeRemaining / (1000 * 60 * 60 * 24)); const hours = Math.floor((timeRemaining % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); const minutes = Math.floor((timeRemaining % (1000 * 60 * 60)) / (1000 * 60)); const seconds = Math.floor((timeRemaining % (1000 * 60)) / 1000); document.getElementById('countdown').innerHTML = `${days}d ${hours}h ${minutes}m ${seconds}s`; } else { clearInterval(countdownInterval); document.getElementById('countdown').innerHTML = 'Expired'; } } </script> </body> </html>

Copy and paste this code into an HTML file and open it in a web browser. Adjust the targetDate variable to the desired date for the countdown. The countdown will then be displayed, updating in real-time.



Flashcard Generator:

6. Write a responsive code for a Flashcard Generator using HTML, CSS, and JavaScript. Allow users to create and study flashcards.


Certainly! Below is a simple example of a responsive Flashcard Generator using HTML, CSS, and JavaScript. Copy and paste the code into three separate files: index.html, style.css, and script.js.


index.html:

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="style.css"> <title>Flashcard Generator</title> </head> <body> <div class="flashcard-container"> <div class="flashcard" id="flashcard"> <div class="card-content"> <div class="card-front"> <p id="front-text">Front</p> </div> <div class="card-back"> <p id="back-text">Back</p> </div> </div> </div> <div class="controls"> <button onclick="prevCard()">Previous</button> <button onclick="flipCard()">Flip</button> <button onclick="nextCard()">Next</button> </div> </div> <div class="flashcard-form"> <h2>Create Flashcards</h2> <form id="flashcard-form"> <label for="front-input">Front:</label> <input type="text" id="front-input" required> <label for="back-input">Back:</label> <input type="text" id="back-input" required> <button type="button" onclick="addFlashcard()">Add Flashcard</button> </form> </div> <script src="script.js"></script> </body> </html>


style.css:

body { font-family: 'Arial', sans-serif; margin: 0; display: flex; justify-content: center; align-items: center; height: 100vh; background-color: #f0f0f0; } .flashcard-container { position: relative; } .flashcard { width: 300px; height: 200px; perspective: 1000px; transform-style: preserve-3d; transition: transform 0.5s; } .card-content { width: 100%; height: 100%; position: absolute; transform-style: preserve-3d; } .card-front, .card-back { width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; position: absolute; backface-visibility: hidden; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); } .card-front { background-color: #ffffff; } .card-back { background-color: #e0e0e0; transform: rotateY(180deg); } .controls { display: flex; justify-content: space-around; margin-top: 10px; } .flashcard-form { margin-top: 20px; text-align: center; } .flashcard-form label { display: block; margin-bottom: 5px; } .flashcard-form input { width: 200px; padding: 5px; margin-bottom: 10px; } .flashcard-form button { padding: 8px 16px; background-color: #4caf50; color: #ffffff; border: none; cursor: pointer; } .flashcard-form button:hover { background-color: #45a049; }


script.js:

const flashcardForm = document.getElementById('flashcard-form'); const frontInput = document.getElementById('front-input'); const backInput = document.getElementById('back-input'); const flashcardContainer = document.getElementById('flashcard'); const frontText = document.getElementById('front-text'); const backText = document.getElementById('back-text'); let flashcards = []; let currentCardIndex = 0; function addFlashcard() { const front = frontInput.value; const back = backInput.value; if (front && back) { const newFlashcard = { front, back }; flashcards.push(newFlashcard); clearForm(); updateFlashcard(); } } function clearForm() { frontInput.value = ''; backInput.value = ''; } function updateFlashcard() { if (flashcards.length > 0) { const currentCard = flashcards[currentCardIndex]; frontText.textContent = currentCard.front; backText.textContent = currentCard.back; } } function prevCard() { if (currentCardIndex > 0) { currentCardIndex--; updateFlashcard(); } } function nextCard() { if (currentCardIndex < flashcards.length - 1) { currentCardIndex++; updateFlashcard(); } } function flipCard() { flashcardContainer.classList.toggle('flipped'); } flashcardForm.addEventListener('submit', function (e) { e.preventDefault(); }); updateFlashcard();


This code creates a simple flashcard generator with a form to add new flashcards and navigation controls to switch between them. The styling is basic and can be further customized based on your preferences.


Voice Recorder:

7. Create a complete responsive code for a Voice Recorder using HTML, CSS, and JavaScript. Allow users to record and download audio files.



Sure, here's a simple example of a responsive voice recorder using HTML, CSS, and JavaScript. This example uses the MediaRecorder API for recording audio and creates a downloadable link for the recorded audio file:

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Voice Recorder</title> <style> body { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100vh; margin: 0; font-family: Arial, sans-serif; } #controls { display: flex; flex-direction: column; align-items: center; } #record, #stop, #download { margin: 10px; padding: 10px; font-size: 16px; cursor: pointer; } #download { display: none; } </style> </head> <body> <div id="controls"> <button id="record">Record</button> <button id="stop" disabled>Stop</button> <a id="download" download="recording.wav"></a> </div> <script> document.addEventListener('DOMContentLoaded', () => { let mediaRecorder; let chunks = []; const recordButton = document.getElementById('record'); const stopButton = document.getElementById('stop'); const downloadButton = document.getElementById('download'); recordButton.addEventListener('click', startRecording); stopButton.addEventListener('click', stopRecording); function startRecording() { navigator.mediaDevices.getUserMedia({ audio: true }) .then((stream) => { mediaRecorder = new MediaRecorder(stream); mediaRecorder.ondataavailable = (e) => { if (e.data.size > 0) { chunks.push(e.data); } }; mediaRecorder.onstop = () => { const blob = new Blob(chunks, { type: 'audio/wav' }); const url = URL.createObjectURL(blob); downloadButton.href = url; downloadButton.style.display = 'block'; downloadButton.innerHTML = 'Download Recording'; downloadButton.disabled = false; }; recordButton.disabled = true; stopButton.disabled = false; mediaRecorder.start(); }) .catch((err) => console.error('Error accessing microphone:', err)); } function stopRecording() { mediaRecorder.stop(); recordButton.disabled = false; stopButton.disabled = true; } }); </script> </body> </html>


This code creates a simple web page with buttons to start and stop recording, and a button to download the recorded audio file. Note that this example uses the audio/wav MIME type for the recorded audio file. You can adjust it based on your preferences and browser compatibility.

Keep in mind that some browsers may require the page to be served over HTTPS to access the microphone. Additionally, the MediaRecorder API may not be supported in all browsers, so you may want to check for compatibility based on your target audience.


URL Preview Generator:

8. Develop a responsive code for a URL Preview Generator using HTML, CSS, and JavaScript. Display a preview of a website when a URL is entered.


Certainly! Below is a simple example of a URL Preview Generator using HTML, CSS, and JavaScript. This example uses the Open Graph Protocol (OGP) to fetch information about the URL and display a preview.


<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>URL Preview Generator</title> <style> body { font-family: Arial, sans-serif; margin: 20px; } #preview-container { border: 1px solid #ccc; padding: 10px; margin-top: 20px; max-width: 600px; } #preview-container img { max-width: 100%; height: auto; } #url-input { width: 100%; padding: 8px; font-size: 16px; } #generate-btn { padding: 8px 16px; font-size: 16px; cursor: pointer; } </style> </head> <body> <label for="url-input">Enter URL:</label> <input type="text" id="url-input" placeholder="https://example.com"> <button id="generate-btn" onclick="generatePreview()">Generate Preview</button> <div id="preview-container"></div> <script> function generatePreview() { const urlInput = document.getElementById('url-input').value; const previewContainer = document.getElementById('preview-container'); // Clear previous preview previewContainer.innerHTML = ''; // Fetch Open Graph data fetch(`https://graph.facebook.com/v10.0/?id=${urlInput}&fields=title,description,image`) .then(response => response.json()) .then(data => { // Display preview const title = data.title || 'No title available'; const description = data.description || 'No description available'; const image = data.image ? `<img src="${data.image}" alt="Preview Image">` : ''; previewContainer.innerHTML = ` <h2>${title}</h2> <p>${description}</p> ${image} `; }) .catch(error => { console.error('Error fetching preview data:', error); previewContainer.innerHTML = 'Error fetching preview data'; }); } </script> </body> </html>


This code includes an input field for entering the URL, a button to trigger the preview generation, and a container to display the preview information (title, description, and image). The Open Graph data is fetched using the Facebook Graph API. Please note that this example uses a simple approach and may not work for all websites, as not all websites support the Open Graph Protocol.


Jigsaw Puzzle Game:

9. Write a complete responsive code for a Jigsaw Puzzle Game using HTML, CSS, and JavaScript. Allow users to drag and drop puzzle pieces.

Sure, I can provide you with a simple example of a responsive Jigsaw Puzzle Game using HTML, CSS, and JavaScript. Please note that this example is quite basic, and you might want to enhance it based on your specific requirements.

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <style> body { font-family: Arial, sans-serif; display: flex; align-items: center; justify-content: center; height: 100vh; margin: 0; } #puzzle-container { position: relative; border: 2px solid #333; overflow: hidden; } .puzzle-piece { position: absolute; border: 2px solid #fff; cursor: pointer; } </style> </head> <body> <div id="puzzle-container"></div> <script> document.addEventListener("DOMContentLoaded", function() { const puzzleContainer = document.getElementById("puzzle-container"); const pieces = [ { id: 1, top: 0, left: 0 }, { id: 2, top: 0, left: 100 }, { id: 3, top: 0, left: 200 }, { id: 4, top: 100, left: 0 }, { id: 5, top: 100, left: 100 }, { id: 6, top: 100, left: 200 }, { id: 7, top: 200, left: 0 }, { id: 8, top: 200, left: 100 }, { id: 9, top: 200, left: 200 } ]; pieces.forEach(piece => { const puzzlePiece = document.createElement("div"); puzzlePiece.classList.add("puzzle-piece"); puzzlePiece.setAttribute("draggable", "true"); puzzlePiece.style.width = "100px"; puzzlePiece.style.height = "100px"; puzzlePiece.style.top = piece.top + "px"; puzzlePiece.style.left = piece.left + "px"; puzzlePiece.style.backgroundImage = "url('path/to/your/image.jpg')"; // Replace with your image path puzzlePiece.style.backgroundSize = "300px 300px"; // Adjust based on your image dimensions puzzlePiece.style.backgroundPosition = `-${piece.left}px -${piece.top}px`; puzzlePiece.addEventListener("dragstart", dragStart); puzzleContainer.appendChild(puzzlePiece); }); function dragStart(e) { e.dataTransfer.setData("text/plain", e.target.id); } puzzleContainer.addEventListener("dragover", dragOver); puzzleContainer.addEventListener("drop", drop); function dragOver(e) { e.preventDefault(); } function drop(e) { e.preventDefault(); const pieceId = e.dataTransfer.getData("text/plain"); const puzzlePiece = document.getElementById(pieceId); const puzzleRect = puzzleContainer.getBoundingClientRect(); const pieceRect = puzzlePiece.getBoundingClientRect(); const offsetX = e.clientX - pieceRect.width / 2 - puzzleRect.left; const offsetY = e.clientY - pieceRect.height / 2 - puzzleRect.top; puzzlePiece.style.left = offsetX + "px"; puzzlePiece.style.top = offsetY + "px"; } }); </script> </body> </html>


In this example:

  • The puzzle pieces are created dynamically and positioned in a grid.
  • Each puzzle piece is draggable and can be dropped onto the puzzle container.
  • Adjust the backgroundImage property to your actual image path, and adjust backgroundSize based on your image dimensions.

This is a basic example, and you might need to add additional features, such as checking whether the puzzle is completed or shuffling the pieces. Feel free to customize and enhance the code based on your specific requirements.


Expense Tracker:

10.Create a responsive code for an Expense Tracker using HTML, CSS, and JavaScript. Allow users to add, categorize, and track their expenses.


Certainly! Below is a simple example of an Expense Tracker using HTML, CSS, and JavaScript. This example uses a basic structure with minimal styling for simplicity. You can further enhance the design and functionality based on your preferences.


<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Expense Tracker</title> <style> body { font-family: 'Arial', sans-serif; margin: 0; padding: 0; display: flex; justify-content: center; align-items: center; height: 100vh; background-color: #f4f4f4; } #expense-container { width: 400px; padding: 20px; background-color: #fff; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); border-radius: 8px; } h2 { text-align: center; } label { display: block; margin-bottom: 8px; } input { width: 100%; padding: 8px; margin-bottom: 16px; box-sizing: border-box; } select { width: 100%; padding: 8px; margin-bottom: 16px; box-sizing: border-box; } button { background-color: #4caf50; color: #fff; padding: 10px; border: none; border-radius: 4px; cursor: pointer; width: 100%; } #expense-list { margin-top: 20px; } ul { list-style-type: none; padding: 0; } li { display: flex; justify-content: space-between; border-bottom: 1px solid #ddd; padding: 8px 0; } </style> </head> <body> <div id="expense-container"> <h2>Expense Tracker</h2> <label for="expenseName">Expense Name:</label> <input type="text" id="expenseName" placeholder="Enter expense name"> <label for="category">Category:</label> <select id="category"> <option value="groceries">Groceries</option> <option value="utilities">Utilities</option> <option value="entertainment">Entertainment</option> <!-- Add more categories as needed --> </select> <label for="amount">Amount:</label> <input type="number" id="amount" placeholder="Enter amount"> <button onclick="addExpense()">Add Expense</button> <div id="expense-list"> <h3>Expense List</h3> <ul id="list"></ul> </div> </div> <script> function addExpense() { const expenseName = document.getElementById('expenseName').value; const category = document.getElementById('category').value; const amount = document.getElementById('amount').value; if (expenseName && amount) { const listItem = document.createElement('li'); listItem.innerHTML = ` <span>${expenseName}</span> <span>${category}</span> <span>${amount}</span> `; document.getElementById('list').appendChild(listItem); // Clear input fields document.getElementById('expenseName').value = ''; document.getElementById('amount').value = ''; } else { alert('Please enter both expense name and amount.'); } } </script> </body> </html>



This is a basic implementation, and you can extend it by adding more features like editing or deleting expenses, adding a date field, or storing data persistently using a backend server or local storage. Additionally, you might want to include more styling to enhance the visual appeal of your expense tracker.







prompts for text based AI websites for Generating multiple with all its features in HTML with CSS and JavaScript

  Write 50 prompts for text based AI websites for Generating multiple with all its features in HTML with CSS and JavaScript Screen Recorde...