Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

324
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!