Untitled Post
“
Prayer Times
| Prayer | Time |
|---|---|
| Fajr | |
| Sunrise | |
| Dhuhr | |
| Asr | |
| Maghrib | |
| Isha |
const locationSelect = document.getElementById("location"); const date = document.getElementById("date"); const fajr = document.getElementById("fajr"); const sunrise = document.getElementById("sunrise"); const dhuhr = document.getElementById("dhuhr"); const asr = document.getElementById("asr"); const maghrib = document.getElementById("maghrib"); const isha = document.getElementById("isha");
const prayerTimes = { dhaka: ["4:59", "6:16", "12:09", "3:46", "6:23", "7:41"], chittagong: ["4:41", "6:03", "11:54", "3:35", "6:13", "7:29"], rajshahi: ["5:12", "6:30", "12:23", "4:00", "6:37", "7:54"], khulna: ["5:06", "6:24", "12:18", "3:55", "6:32", "7:49"], barisal: ["4:47", "6:06", "12:01", "3:41", "6:17", "7:33"], sylhet: ["4:46", "6:05", "12:00", "3:39", "6:15", "7:31"], rangpur: ["5:19", "6:38", "12:31", "4:09", "6:45", "8:02"], mymensingh: ["5:01", "6:19", "12:12", "3:49", "6:26", "7:43"] };
function displayPrayerTimes() { const selectedLocation = locationSelect.value; const prayerTimesForSelectedLocation = prayerTimes[selectedLocation];
date.innerText = new Date().toDateString(); fajr.innerText = prayerTimesForSelectedLocation[0]; sunrise.innerText = prayerTimesForSelectedLocation[1]; dhuhr.innerText = prayerTimesForSelectedLocation[2]; asr.innerText = prayerTimesForSelectedLocation[3]; maghrib.innerText = prayerTimesForSelectedLocation[4]; isha.innerText = prayerTimesForSelectedLocation[5]; }
displayPrayerTimes();
locationSelect.addEventListener("change", displayPrayerTimes);