Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

322
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda