Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

326
Visualizações
Javascript Error : Failed To load resource : the server responded with a status of 404()

I am trying to change the image by hovering the mouse over the image through the javascript functions. It was working properly fine till yet. But lately when I hover the mouse over the image, the main image disappears that means the javascript code doesn't work somehow. I have debugged it on the browser and got to know about the error which I have mentioned above. I have tried to change the path of the image inside javascript and also tried to change the path of the javascript file. But it doesn't work for me. P.S. - I am working on an ASP.Net core mvc website So my javascript file is bound with the layout page.

Here is the code of the javascript functions which I use :

function SwitchOn() {
    pic = "../images/switchon.png";
    document.getElementById('headImg').src = pic;
}

function SwitchOff() {
    pic = "../images/logo.png";
    document.getElementById('headImg').src = pic;
}

These both functions exist in webvalidations.js file which is bound with the layout page. enter image description here

This is how the image disappears and error looks like when I hover the mouse over it : enter image description here

This is the way I use both the functions via event in the img tag :

<img src="~/images/logo.png" id="headImg" onmouseover="SwitchOn()" onmouseout="SwitchOff()" style="height:100px;width:100px;" />

P.S. Image only disappears when I hover over it.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda