google-site-verification: google722da71d349632d6.html Country code finder Tool Skip to main content

Interest for Development and Coding Tools

Country code finder Tool

Country Code Finder

Country Code Finder

body { font-family: Arial, sans-serif; background-color: #f0f0f0; display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; } .container { text-align: center; background-color: white; padding: 20px; border-radius: 8px; box-shadow: 0 4px 8px rgba(0,0,0,0.1); max-width: 400px; width: 100%; } h1 { color: #333; } .input-section { margin-bottom: 20px; text-align: left; } label { font-weight: bold; margin-bottom: 8px; display: block; } input[type="text"] { width: calc(100% - 90px); padding: 10px; border: 1px solid #ccc; border-radius: 4px; font-size: 16px; } button { padding: 10px 20px; background-color: #4CAF50; color: white; border: none; cursor: pointer; border-radius: 4px; margin-left: 10px; } button:hover { background-color: #45a049; } #output { text-align: left; max-width: 100%; overflow-x: auto; padding: 10px; background-color: #f9f9f9; border: 1px solid #ccc; border-radius: 4px; display: none; /* Hidden by default */ } const countryCodes = { "Afghanistan": "AF", "Albania": "AL", "Algeria": "DZ", "American Samoa": "AS", // Add more countries as needed }; function findCountry() { const input = document.getElementById('countryInput').value.trim(); const outputDiv = document.getElementById('output'); if (input === '') { outputDiv.style.display = 'none'; return; } let countryCode = countryCodes[input]; if (!countryCode) { // Check if input matches a country code countryCode = Object.keys(countryCodes).find(key => countryCodes[key] === input.toUpperCase()); } if (countryCode) { outputDiv.textContent = `Country Code for "${input}": ${countryCode}`; } else { outputDiv.textContent = `Country code not found for "${input}"`; } outputDiv.style.display = 'block'; }

Comments

Popular posts from this blog