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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:19:01+00:00 2026-05-25T17:19:01+00:00

I am trying to make a mouse roll-over. i.e when user places the pointer

  • 0

I am trying to make a mouse roll-over. i.e when user places the pointer on the image mouse over event is triggered and the next image from the array comes over.But nothing is happening when i am running this script :

window.onload = startRollOver;

var pictures = new  Array("1.jpg","2.jpg","3.jpg","4.jpg","5.jpg","6.jpg","7.jpg","8.jpg");
var i = 0;

function startRollOver() {
document.getElementById("picture").src.onmouseover = createRollOver();
}

function createRollOver() {
if(i<=7)
   return pictures[i++];
 if(i>7) {
    i=0;
    return pictures[i];
 }
}

Where am i going wrong ?

  • 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-25T17:19:02+00:00Added an answer on May 25, 2026 at 5:19 pm

    .src.onmouseover does not make much sense. You should assign a function to onmouseover so that the function gets called when the mouse moves over the element:

    document.getElementById("picture").onmouseover = function() { // is executed when mouse is over element
        this.src = createRollOver(); // each time it is called, change the src
    };
    

    Also, you can use a more convenient way of declaring arrays:

    ["1.jpg", "2.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 a image shake on mouse over, I got it to
I'm trying to make a mouse over for a stack panel in WPF using
I am trying to make a div popup next to the mouse when a
I am trying to make it so that when you hover your mouse over
I'm trying to make a button which glows when the mouse is pointed over
I'm trying to make a div's background color change on mouse over . the
I am trying to make a zoom effect on a picturebox with mouse wheel.
I am trying to make a socket server that spews mouse move events, in
I'm trying to make a simple CSS drop down menu that when you mouse
im trying to make an image gallery. the container class that adds the thumbnail

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.