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 6881879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:11:05+00:00 2026-05-27T05:11:05+00:00

just joined today loved this site already. My Question is that. i am trying

  • 0

just joined today loved this site already.

My Question is that. i am trying to create 6 Menus for my Web. like Eg { home, about us, service ….. } and i want the images to change whenever the users mouse hovers the menu’s. I got the scrip actually from online souce. But it was an example for one image Here are the codes:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)

function roll_over(img_name, img_src)
{
document[img_name].src = img_src;
}

And for the body
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)

<A HREF="some.html" onmouseover="roll_over('but1', 'icon2.gif')"
onmouseout="roll_over('but1', 'icon1.gif')">
<IMG SRC="icon1.gif" WIDTH="100" HEIGHT="50"
NAME="but1" BORDER="0">
</A>

Now i tried to multiply these five times, ( just repeated the codes and changed the picture name ) – But whenever i hover on the images they do not change.

So my Q – is: How do you make the above code from a one image changer to 6?

Thanks !

  • 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-27T05:11:06+00:00Added an answer on May 27, 2026 at 5:11 am

    Ok I figured it out. Should set a unique name for every Image.
    Try this code
    JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)

    <script>
    function roll_over(img_name, img_src)
    {
    document[img_name].src = img_src;
    }
    </script>
    
    <A HREF="some.html" onmouseover="roll_over('but1', '10.gif')"
    onmouseout="roll_over('but1', '10-roll.gif')">
    <IMG SRC="10-roll.gif" WIDTH="100" HEIGHT="50"
    NAME="but1" BORDER="0">
    </A>
    
    <A HREF="some.html" onmouseover="roll_over('but2', '1-roll.gif')"
    onmouseout="roll_over('but2', '1.gif')">
    <IMG SRC="1.gif" WIDTH="100" HEIGHT="50"
    NAME="but2" BORDER="0">
    </A>
    
    <A HREF="some.html" onmouseover="roll_over('but3', '2-roll.gif')"
    onmouseout="roll_over('but3', '2.gif')">
    <IMG SRC="2.gif" WIDTH="100" HEIGHT="50"
    NAME="but3" BORDER="0">
    </A>
    

    hope this works

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just joined this site after looking very hard for an answer to my
I have just joined a team that has thousands of lines of code like:
This is not a homework question, just something at work that's bugging me. I'm
just joined this awesome site… Ive recently been working in XNA on C#, making
Trying to create an outer join on two other joined tables when recieving this
I just joined a web dev project that uses Symfony 1.4 on CentOS 5.4
I just joined this wonderful community, but it is with regret that I admit
Just learning the world of jquery, and all my googling gives examples like this:
Just a knowledge question which I would like to ask: For example, I have
The project that I have just joined uses the command pattern quite extensively for

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.