Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4032892
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:46:42+00:00 2026-05-20T11:46:42+00:00

I’m a JavaScript newbie working on a website and I’ve run into an issue

  • 0

I’m a JavaScript newbie working on a website and I’ve run into an issue that’s beyond my ken to solve…

I made some picture links and have been researching the well-known image swap on mouseover JavaScript effect that can be found all over the web. I have some simple white image pics that I want to switch to blue when a user scrolls over them. I got bits of code from here and there and slowly pieced together a beginners understanding of the inner workings of what I’m trying to do. I threw together a quick sandbox html file with just the javascript code and you can see that here.

(Notice the script functioning without a problem)

Now when I migrated the working code into my homepage, everything seems alright except for ugly blue highlights that now appear around the links when the cursor is hovered over them

See here:

http://www.kendallfrancis.com/

I really want to fix this !

If you could help I’d be very, very grateful as most of my day has been spent in vain trying to figure this out – I need some expert perspective!

Here’s my (bloated) code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">    
<head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  <title>Kendall Francis | Musician | Galactic Circus Diplodocus</title>
  <meta content="Kendall Francis" name="author">
  <meta content="Kendall Francis 1990-2011" name="copyright">
  <meta content="all" name="robots">
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <style type="text/css"><!-- @import "francis.css";--></style>

  <SCRIPT LANGUAGE="JavaScript">
<!--
if (document.images) {
   var mus1 = new Image();
   mus1.src = "images/music1.jpg";
   var mus2 = new Image();
   mus2.src = "images/music2.jpg";
}

function show_music() {
  if (document.images) {
    document["mus"].src = mus2.src;
  }
}

function hide_music() {
  if (document.images) {
    document["mus"].src = mus1.src;
  }
} 
//-->
<!--
if (document.images) {
   var pho1 = new Image();
   pho1.src = "images/photo1.jpg";
   var pho2 = new Image();
   pho2.src = "images/photo2.jpg";
}

function show_photo() {
  if (document.images) {
    document["pho"].src = pho2.src;
  }
}

function hide_photo() {
  if (document.images) {
    document["pho"].src = pho1.src;
  }
} 
//-->
<!--
if (document.images) {
   var vid1 = new Image();
   vid1.src = "images/video1.jpg";
   var vid2 = new Image();
   vid2.src = "images/video2.jpg";
}

function show_video() {
  if (document.images) {
    document["vid"].src = vid2.src;
  }
}

function hide_video() {
  if (document.images) {
    document["vid"].src = vid1.src;
  }
} 
//-->
<!--
if (document.images) {
   var who1 = new Image();
   who1.src = "images/who1.jpg";
   var who2 = new Image();
   who2.src = "images/who2.jpg";
}

function show_who() {
  if (document.images) {
    document["who"].src = who2.src;
  }
}

function hide_who() {
  if (document.images) {
    document["who"].src = who1.src;
  }
} 
//-->
</SCRIPT>       
</head>    
<body>
<div class="cenimg">
<img src="images/break.jpg" alt="kendallfrancis.com" title="Perpetual growth" width="424px" height="456px" class="imgcen"/>
</div>
<div>
   <div align="center">
    <a href="music.htm"
  onMouseOver="show_music(); return true" 
  onMouseOut="hide_music()">
<IMG SRC="images/music1.jpg" ALT="Kendall's music" title="Kendall's music" 
  WIDTH="200" HEIGHT="40" name="mus" border=0></a>
  <img src="images/duck.jpg" title="What the duck?" alt="What the duck?" width="45px" height="40px">
  <a href="photo.htm"
  onMouseOver="show_photo(); return true" 
  onMouseOut="hide_photo()">
<IMG SRC="images/photo1.jpg" ALT="Kendall's photos" title="Kendall's photos"
  WIDTH="200" HEIGHT="40" name="pho" border=0></a>      
  <img src="images/duck.jpg" alt="What the duck?" title="quack!" width="45px" height="40px">      
    <a href="video.htm"
  onMouseOver="show_video(); return true" 
  onMouseOut="hide_video()">
<IMG SRC="images/video1.jpg" ALT="Kendall's videos" title="Kendall's videos"
  WIDTH="200" HEIGHT="40" name="vid" border=0></a>          
  <img src="images/duck.jpg" title="You're despicable!" alt="What the duck?" width="45px" height="40px">          
      <a href="who.htm"
  onMouseOver="show_who(); return true" 
  onMouseOut="hide_who()">
<IMG SRC="images/who1.jpg" ALT="Who is this guy?" title="Who is this guy?" 
  WIDTH="200" HEIGHT="40" name="who" border=0></a>      
</div>
</body>    
</html>

Also, if you have any tips on how I can cut down on the amount of code (I read something about function with arguments, or something… but didn’t really understand it) er… yeah as you can tell I’m a real amateur…. But I’m real willing to learn if you’re willing to bear with me!

Oh, and I did search for this before hand — a lot — could not find anything applicable. But, my apologies if you know this has been answered before.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T11:46:43+00:00Added an answer on May 20, 2026 at 11:46 am

    Those highlights are in the over-image themselves – the background is not totally black

    Here is the shorter code

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html lang="en">
    <head>
      <meta http-equiv="content-type" content="text/html; charset=utf-8">
      <title>Kendall Francis | Musician | Galactic Circus Diplodocus</title>
      <meta content="Kendall Francis" name="author">
      <meta content="Kendall Francis 1990-2011" name="copyright">
      <meta content="all" name="robots">
      <style type="text/css"><!-- @import "francis.css";--></style>
    
    <script type="text/javascript">
      // an object containing one member per image 
      // with the corresponding images in an array
      var links = {
        "music":  ["images/music1.jpg","images/music2.jpg"],
        "photo":  ["images/photo1.jpg","images/photo2.jpg"],
        "video":  ["images/video1.jpg","images/video2.jpg"],
        "who"  :  ["images/who1.jpg",  "images/who2.jpg"]
      } // note: no comma after the last entry
    
      // preload
      for (var o in links) {
        links[o].images = []; // create an array
        for (var i=0;i<links[o].length;i++) { // only two images but could be more
          links[o].images[i]=new Image();
          links[o].images[i].src=links[o][i];
        }
      }
    
    function show(img,idx) { 
      // pass the name of the image, which is also the key to the links object
      // the idx is 1 for over and 0 for out
      document[img].src = links[img].images[idx].src; 
    }
    </script>
    
    </head>
    
    <body>
    <div class="cenimg">
    <img src="images/break.jpg" alt="kendallfrancis.com" title="Perpetual growth" width="424px" height="456px" class="imgcen"/>
    </div>
    <div>
    
       <div align="center">
    
        <a href="music.htm"
      onMouseOver="show('music',1); return true" 
      onMouseOut="show('music',0); return true"><img 
      src="images/music1.jpg" alt="Kendall's music" title="Kendall's music" width="200" height="40" name="music" border="0"></a>
    
      <img src="images/duck.jpg" title="What the duck?" alt="What the duck?" width="45px" height="40px">
    
      <a href="photo.htm"
      onMouseOver="show('photo',1); return true" 
      onMouseOut="show('photo',0)"><img 
      src="images/photo1.jpg" alt="Kendall's photos" title="Kendall's photos" width="200" height="40" name="photo" border="0"></a>
    
      <img src="images/duck.jpg" alt="What the duck?" title="quack!" width="45px" height="40px">
    
        <a href="video.htm"
      onMouseOver="show('video',1); return true" 
      onMouseOut="show('video',0)"><img 
      src="images/video1.jpg" alt="Kendall's videos" title="Kendall's videos" width="200" height="40" name="video" border="0"></a>
    
      <img src="images/duck.jpg" title="You're despicable!" alt="What the duck?" width="45px" height="40px">
    
          <a href="who.htm"
      onMouseOver="show('who',1); return true" 
      onMouseOut="show('who',0)"><img 
      src="images/who1.jpg" ALT="Who is this guy?" title="Who is this guy?" width="200" height="40" name="who" border="0"></a>
    
    
    </div>
    
    </body>
    
    
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I used javascript for loading a picture on my website depending on which small
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on
this is what i have right now Drawing an RSS feed into the php,
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I want to count how many characters a certain string has in PHP, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.