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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:19:15+00:00 2026-06-15T01:19:15+00:00

I was trying to make an image to change on mouse over. This piece

  • 0

I was trying to make an image to change on mouse over. This piece of code works for IE but not for the other browsers like chrome, opera, safari, etc. Any ideas?

<a href="#" onmouseover="document.myimage1.src='img/login_button_22.jpg';"
onmouseout="document.myimage1.src='img/login_button_11.jpg';">    
<img src="img/login_button_11.jpg" name="myimage1" /> </a>
  • 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-06-15T01:19:16+00:00Added an answer on June 15, 2026 at 1:19 am

    You should be using a ID, not a NAME, and using document.getElementById to select the element.

    IMG elements, not being FORM elements, should not be able to take on a NAME property, but Microsoft managed to screw this up.

    <a href="#" onmouseover="document.getElementById('myimage1').src='img/login_button_22.jpg';"
    onmouseout="document.getElementById('myimage1').src='img/login_button_11.jpg';">    
    <img src="img/login_button_11.jpg" id="myimage1" /></a>
    

    Also, it’s much easier and cleaner to use a CSS background and a :hover declaration and skip doing this using JavaScript completely.

    Here’s how:

    HTML:

    <a class="mybutton" href="#"></a>
    

    CSS (adjust dimensions accordingly):

    .myButton {
         width:100px;
         height:50px;
         display:block;
         background-image:url(../img/login_button_11.jpg);
    
    }
    
    .myButton:hover {
         background-image:url(../img/login_button_22.jpg)
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make changing background image by menu item. It's works now but
So I was trying to make a button that will change image when mouse
I'm trying to make an image change its rotation between 2 position in an
I am trying to make an image slider but i don't get how it
Here's the code I'm currently working with: http://jsfiddle.net/gEMCm/ I'm trying to make an image
I am trying to make an accordion image gallery that works based off an
I'm trying to make the background color change on :hover but keep the background
I'm trying to make this button change background when you click it and this
I'm trying to make a background fade in when you mouse over a box.
i'm trying to make some change in the following code which updates the number

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.