/    Sign up×
Community /Pin to ProfileBookmark

Call two events on mouseover?

I’d like to have two seperate images have a mouseover effect when only one of them has someone mouse over them.

In other words, I have two images, and when either one of them someone mouses over them, there will be a mouseover effect for BOTH simultaneously.

is this possible?

thanks

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@mark_yiehAug 07.2006 — firstImage.onmouseover = function() {

firstImageEffect();

secondImage Effect();

};

secondImage.onmouseover = function() {

firstImageEffect();

secondImageEffect();

};

function firstImageEffect() {

create the effect for the first image in this function.

}

function secondImageEffect() {

create the effect for the second image in this fucntion.

}
Copy linkTweet thisAlerts:
@blackgoldauthorAug 07.2006 — firstImage.onmouseover = function() {

firstImageEffect();

secondImage Effect();

};

secondImage.onmouseover = function() {

firstImageEffect();

secondImageEffect();

};

function firstImageEffect() {

create the effect for the first image in this function.

}

function secondImageEffect() {

create the effect for the second image in this fucntion.

}[/QUOTE]


thanks! let me give it a shot ?
Copy linkTweet thisAlerts:
@mark_yiehAug 08.2006 — you can make it even simpler by setting up a function that will take in the image as a variable and add the effect to the image. So instead of having two functions firstImageEffect, and secondImageEffect, you can create a function like this:

function imageEffect(targetImage) {

create the effect to targetImage in this function.

}

Then you can just call that function twice, each with a different variable like this:

firstImage.onmouseover = function() {

imageEffect(firstImage);

imageEffect(secondImage);

};

secondImage.onmouseover = function() {

imageEffect(firstImage);

imageEffect(secondImage);

};
Copy linkTweet thisAlerts:
@konithomimoAug 08.2006 — Just create the two seperate functions and then add the following to both images:

onmouseover="function1();funtion2();"

where function1 and function2 are replaced by the names of your two functions.
×

Success!

Help @blackgold spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...