"404 не найден"
"Не найден
Запрошенный URL-адрес не найден на этом сервере.
Apache/2.4.58 (Win64) OpenSSL/3.1.3 PHP/8.2.12 Сервер на локальном хосте, порт 80"
Я пытался придумать что-то, что работает:
Белградская энциклопедия — это веб-сайт, расположенный в Белграде, Сербия...
Но это не работает.
Код: Выделить всё
document.addEventListener('DOMContentLoaded', () => {
const searchInput = document.getElementById("search");
const resultsBox = document.getElementById("search-results");
const pages = [{
name: "Belgrade",
link: "http://localhost/belgrade.php"
},
{
name: "Home",
link: "http://localhost/betah_website.php"
},
{
name: "Serbia",
link: "http://localhost/serbia.php"
}
];
// --- Search box behavior ---
if (searchInput && resultsBox) {
resultsBox.style.display = "none";
searchInput.addEventListener("input", () => {
const query = searchInput.value.trim().toLowerCase();
resultsBox.innerHTML = "";
if (!query) {
resultsBox.style.display = "none";
return;
}
const matches = pages
.filter(p => p.name.toLowerCase().includes(query))
.sort((a, b) =>
a.name.toLowerCase().indexOf(query) - b.name.toLowerCase().indexOf(query)
);
matches.forEach(match => {
const li = document.createElement("li");
const a = document.createElement("a");
a.href = match.link;
a.textContent = match.name;
li.appendChild(a);
resultsBox.appendChild(li);
});
resultsBox.style.display = matches.length ? "block" : "none";
});
}
});Код: Выделить всё
[list][/list]
Подробнее здесь: https://stackoverflow.com/questions/798 ... t-php-file
Мобильная версия