Usually such an application has a very well defined database structure, with relationships between tables, if necessary, and a server-side programming language controlling everything. If your application hasn’t shown a need for it all, okay, but making things dynamic on a static content site is hard work and doesn’t always produce satisfactory results. That said, I recommend you to study a programming language and database. The combination PHP + Mysql is very receptive to beginners.
Only with Javascript is it possible to create something, but as I said, the result is not always so satisfactory. Given that your entire site has been built into static files, directly into HTML, I believe that the amount of content should be small - if not, you should learn the programming language urgently. And since you just want to do a search and redirect, you can store the data of all the movies in a structure in Javascript and use it in searches.
Let’s assume there are three movies, then you could do something like:
const movies = [
{title: "Alice no País das Maravilhas", url: "alice.html"},
{title: "Harry Potter e a Pedra Filosofal", url: "harry.html"},
{title: "Karate Kid", url: "karate.html"}
];
Whenever a new movie is added to the site, this structure should be updated manually. So, by typing something into the search field, you could perform a search Fuzzy in the titles of the films returning the related titles.
const movies = [{
title: "Alice no País das Maravilhas",
url: "alice.html"
},
{
title: "Harry Potter e a Pedra Filosofal",
url: "harry.html"
},
{
title: "Karate Kid",
url: "karate.html"
}
];
// Estes elementos servirão para a manipulação do DOM: elementos HTML
const title = document.getElementById("title");
const list = document.getElementById("movies");
// Aqui atribuímos uma função ao evento `keyup` do campo no HTML
// Isto é, sempre que uma tecla for pressionada, a função será executada:
title.addEventListener("keyup", function(event) {
// Filtramos a lista de filmes com base no texto digitado:
const matchs = movies.filter(value => {
// Se o texto digitado for encontrado no título, retorna o registro:
return value.title.indexOf(this.value) !== -1;
});
// Exibe no HTML a lista de filmes do resultado do filtro anterior:
list.innerHTML = "";
for (let movie of matchs) {
list.innerHTML += "<li><a href='"+movie.url+"'>"+movie.title+"</a></li>";
}
});
<input type="text" id="title" placeholder="Digite o título do filme">
<ul id="movies"></ul>
Note that when you start typing a title in the field a list of suggestions with the links to each movie is created right below. If this result is already satisfactory for you, you can already conclude that you need to study Javascript.
Welcome, to get an answer that solves your question/problem, please read How to ask a good question? and How to create a Minimum, Complete and Verifiable example
– NoobSaibot
For this you will need a programming language. Depending on the structure of your application this language should be executed on the Javascript-aided server side or only this second. In general, your question is too wide and cannot be answered. How are the film data stored? Are you using any language on the server? What? What database? Do you know about Javascript?
– Woss
I have no server yet, the site is all in html and css. each movie is a page, and to redirect use a figure with anchor. Basically this. I have no knowledge in JS. And I have no database
– Mateus Santos
With pure HTML you won’t be able to do anything
– MarceloBoni
And with JS, what would a base look like?
– Mateus Santos