Prerequisite:
1. Get your free API key from https://openweathermap.org/api
2. Replace YOUR_API_KEY_HERE with your real API key in the code
Calculator 1 - Basic
Calculator 2 - More Advanced
In the code, find this line:
const apiUrl = 'https://cors-anywhere.herokuapp.com/https://api.spoonacular.com/recipes/complexSearch?query={ingredient}&apiKey=YOUR_API_KEY';
Replace YOUR_API_KEY with your real Spoonacular API key.
You can get your key from: https://spoonacular.com/food-api
Example:
const apiUrl = 'https://cors-anywhere.herokuapp.com/https://api.spoonacular.com/recipes/complexSearch?query={ingredient}&apiKey=123456abcdef';
Try entering an ingredient like:
chicken
Then click the Search button.
This app uses the OMDb API, so you need an API key.
abc12345
Find this line in the code:
const apiKey = 'YOUR_API_KEY';
Replace 'YOUR_API_KEY'
with the key you got from OMDb, like:
const apiKey = 'abc12345';
Matrix
) in the input fieldThe app works without a server. It’s pure HTML + JS.
If nothing appears, check:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Blog Website</title> <style> * { box-sizing: border-box; font-family: Arial, sans-serif; } body { margin: 0; padding: 20px; background-color: #f9f9f9; } .container { max-width: 800px; margin: auto; background: white; padding: 20px; border-radius: 10px; box-shadow: 0 0 10px rgba(0,0,0,0.1); } h1 { text-align: center; color: #333; } input, textarea, button { width: 100%; padding: 10px; margin-top: 10px; margin-bottom: 10px; border-radius: 5px; border: 1px solid #ccc; } button { background-color: #28a745; color: white; cursor: pointer; } button:hover { background-color: #218838; } .blog-post { padding: 15px; margin: 10px 0; border: 1px solid #ddd; border-radius: 5px; background-color: #fff; } .blog-title { font-size: 24px; color: #333; } .blog-content { font-size: 16px; color: #555; margin-top: 10px; } .button-container { display: flex; justify-content: flex-end; gap: 10px; } .delete-btn { background-color: red; color: white; border: none; padding: 5px 10px; border-radius: 3px; cursor: pointer; } .delete-btn:hover { background-color: darkred; } .edit-btn { background-color: #ffc107; color: white; border: none; padding: 5px 10px; border-radius: 3px; cursor: pointer; } .edit-btn:hover { background-color: #e0a800; } @media (max-width: 600px) { .container { padding: 10px; } input, textarea, button { padding: 8px; } .blog-title { font-size: 20px; } .blog-content { font-size: 14px; } } </style> </head> <body> <div class="container"> <h1>Blog Website</h1> <input type="text" id="title" placeholder="Enter Blog Title"> <textarea id="content" placeholder="Write your blog content..." rows="5"></textarea> <button onclick="addPost()">Add Blog Post</button> <div id="blogPosts"></div> </div> <script> let posts = []; function addPost() { const title = document.getElementById('title').value; const content = document.getElementById('content').value; if (!title || !content) { alert('Please fill in both title and content'); return; } const newPost = { title: title, content: content, id: posts.length + 1 }; posts.push(newPost); displayPosts(); document.getElementById('title').value = ''; document.getElementById('content').value = ''; } function displayPosts() { const blogPostsContainer = document.getElementById('blogPosts'); blogPostsContainer.innerHTML = ''; posts.forEach(post => { const postDiv = document.createElement('div'); postDiv.classList.add('blog-post'); postDiv.innerHTML = ` <div class="blog-title">${post.title}</div> <div class="blog-content">${post.content}</div> <div class="button-container"> <button class="edit-btn" onclick="editPost(${post.id})">Edit</button> <button class="delete-btn" onclick="deletePost(${post.id})">Delete</button> </div> `; blogPostsContainer.appendChild(postDiv); }); } function deletePost(postId) { posts = posts.filter(post => post.id !== postId); displayPosts(); } function editPost(postId) { const post = posts.find(post => post.id === postId); document.getElementById('title').value = post.title; document.getElementById('content').value = post.content; deletePost(postId); } </script> </body> </html>
Vertical Preview
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <!-- Set character encoding --> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- Ensure responsive design --> <title>Enhanced Markdown Previewer</title> <!-- Title of the page --> <style> body { font-family: Arial, sans-serif; margin: 0; padding: 0; display: flex; justify-content: center; align-items: center; height: 100vh; background-color: #f4f4f4; } .container { display: flex; width: 80%; max-width: 1000px; height: 80%; background-color: #fff; box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1); border-radius: 8px; } .editor { width: 50%; padding: 20px; border-right: 1px solid #ddd; } .preview { width: 50%; padding: 20px; overflow-y: auto; background-color: #f9f9f9; } textarea { width: 100%; height: 90%; padding: 10px; font-size: 16px; border: 1px solid #ddd; border-radius: 4px; resize: none; } .preview-content { font-size: 16px; color: #333; } pre { background-color: #f2f2f2; padding: 10px; border-radius: 4px; overflow-x: auto; } code { background-color: #f4f4f4; padding: 2px 4px; border-radius: 4px; } a { color: #3498db; text-decoration: none; } a:hover { text-decoration: underline; } img { max-width: 100%; height: auto; border-radius: 4px; } </style> </head> <body> <div class="container"> <div class="editor"> <h2>Editor</h2> <textarea id="markdownInput" placeholder="Write your markdown here..." oninput="updatePreview()"></textarea> </div> <div class="preview"> <h2>Preview</h2> <div id="markdownPreview" class="preview-content"></div> </div> </div> <script> function updatePreview() { const markdownText = document.getElementById('markdownInput').value; const htmlContent = marked(markdownText); document.getElementById('markdownPreview').innerHTML = htmlContent; } document.getElementById('markdownInput').value = ` # Markdown Previewer Welcome to the **Markdown Previewer**! ## Features - **Real-time preview** - **Links**, **images**, **code blocks** \`\`\` function helloWorld() { console.log('Hello, World!'); } \`\`\` [Google](https://www.google.com)  `; window.onload = updatePreview; </script> <script src="https://cdnjs.cloudflare.com/ajax/libs/marked/2.1.3/marked.min.js"></script> </body> </html>
Horizontal Preview
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Markdown Previewer</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; } .container { display: flex; flex-wrap: wrap; width: 90%; max-width: 1200px; height: 80%; background-color: #fff; box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1); border-radius: 10px; } .editor { width: 50%; padding: 20px; border-right: 1px solid #ddd; } .preview { width: 50%; padding: 20px; overflow-y: auto; background-color: #f9f9f9; } textarea { width: 100%; height: 90%; padding: 10px; font-size: 16px; border: 1px solid #ddd; border-radius: 4px; resize: none; } .preview-content { font-size: 16px; color: #333; } pre { background-color: #f2f2f2; padding: 10px; border-radius: 4px; overflow-x: auto; } code { background-color: #f4f4f4; padding: 2px 4px; border-radius: 4px; } a { color: #3498db; text-decoration: none; } a:hover { text-decoration: underline; } img { max-width: 100%; height: auto; border-radius: 4px; } @media (max-width: 768px) { .editor, .preview { width: 100%; } } </style> </head> <body> <div class="container"> <div class="editor"> <h2>Markdown Editor</h2> <textarea id="markdownInput" placeholder="Write your markdown here..." oninput="updatePreview()"></textarea> </div> <div class="preview"> <h2>Preview</h2> <div id="markdownPreview" class="preview-content"></div> </div> </div> <script> function updatePreview() { const markdownText = document.getElementById('markdownInput').value; const htmlContent = marked(markdownText); document.getElementById('markdownPreview').innerHTML = htmlContent; } document.getElementById('markdownInput').value = ` # Welcome to the Markdown Previewer! This is a simple Markdown Previewer. ## Features - **Real-time preview** - **Support for code blocks** - **Links** and **Images** \`\`\` function sayHello() { console.log('Hello, Markdown!'); } \`\`\` [Google](https://www.google.com)  `; window.onload = updatePreview; </script> <script src="https://cdnjs.cloudflare.com/ajax/libs/marked/2.1.3/marked.min.js"></script> </body> </html>
Simple Quiz App
Advanced Quiz App
playBeep()
function plays a beep sound when the timer runs out.Next Game
Third Game
Fourth game French-English Words
First App
Second App - question - Answer
Single-Page Form
Multi-Page Survey Form
API Key: You need to replace 'YOUR_API_KEY_HERE'
with an actual API key from NewsAPI. Without a valid key, the fetch request won't work.
CORS Issue: If you're testing it locally, your browser might block the API request due to CORS (Cross-Origin Resource Sharing). If that’s the case, try using a local server like VS Code Live Server or a similar tool, or host it on a server to avoid CORS issues.
Get your API Key: Go to OpenWeatherMap and create a free account. After signing in, go to the API section and generate an API key. Replace 'YOUR_API_KEY'
in the code with this key.
Run Locally: Save the code in an .html
file and open it in your browser. If you're running it on your local machine, it should work. If you encounter CORS issues, try running it from a local server (you can use a tool like Live Server if you're using VS Code).
Check Developer Console: If the data isn't displayed correctly, check the browser console for error messages (right-click > Inspect > Console).
Shopping Cart Checkout Form
Views are saved in the user’s browser.
Add this inside your <script> tag:
// Load and initialize view counts from localStorage
document.querySelectorAll('.item').forEach(item => {
const id = item.getAttribute('data-id'); // Get unique ID
const storedCount = localStorage.getItem('view-' + id);
if (storedCount) {
item.querySelector('.view-count').textContent = storedCount;
}
});
Modify the click event:
Before:
let currentCount = parseInt(viewCountEl.textContent);
currentCount++;
viewCountEl.textContent = currentCount;
After:
let currentCount = parseInt(viewCountEl.textContent);
currentCount++;
viewCountEl.textContent = currentCount;
localStorage.setItem('view-' + id, currentCount);
For hosted sites with multiple users.
Load Firebase SDK in HTML:
<script src="https://www.gstatic.com/firebasejs/9.6.1/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/9.6.1/firebase-database.js"></script>
Initialize Firebase:
const firebaseConfig = {
apiKey: "YOUR_KEY",
authDomain: "YOUR_DOMAIN",
databaseURL: "https://YOUR_DB.firebaseio.com",
projectId: "YOUR_PROJECT_ID"
};
firebase.initializeApp(firebaseConfig);
const db = firebase.database();
Fetch & Update View Count:
const id = item.getAttribute('data-id');
const viewRef = db.ref('views/' + id);
viewRef.once('value').then(snapshot => {
let views = snapshot.val() || 0;
views++;
viewRef.set(views); // Save new count
viewCountEl.textContent = views; // Show in UI
});
Method | Works Offline? | Shared Across Users? | Requires Server? |
---|---|---|---|
localStorage | ✅ Yes | ❌ No | ❌ No |
Firebase | ❌ No | ✅ Yes | ✅ Yes |
Node.js + DB | ❌ No | ✅ Yes | ✅ Yes |
Have the viewr on a website updated , show the real numbers of clicks
Only do this for demos. For production, set proper authentication and rules.
Each item shows its view count.
When clicked, it updates both:
View count continues to increase, even across devices or reloads.
Note: Use Firebase for a real demo setup. Ensure to adjust read/write rules in Firebase console.
Total number of views
Updates live when clicked
Stores data online (so the number persists and is shared across devices)
Simple and Free Online Setup Using Firebase Realtime Database
Firebase is a cloud-based backend by Google. It lets you store data like view counts without writing a custom backend server.
Go to your project → click > Web → Register app → Get your config snippet.
Paste this inside your
or before :👁️ 0 views
Visit Page 👁️ 0 views
{ "rules": { ".read": true, ".write": true } }
To use this app, you'll need an API key from a stock data provider like Finnhub. Follow these steps to get the API key:
Another Music Player
Youtube Player
.html
extension. For example, name it job-search-app.html
..html
file, and it will open in your default web browser (such as Google Chrome, Mozilla Firefox, Edge, etc.).For a more complex project setup, you might want to simulate a production environment or interact with APIs using a local web server. Here’s how you can do that:
job-search-app.html
file in Visual Studio Code.If you want to share your app with others or make it publicly accessible online, you can host it on a web hosting platform.
job-search-app
.https://your-username.github.io/repository-name
. For example: https://johnDoe.github.io/job-search-app
.