/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Drop Down onMouseover Function

Ok I’ve been asking this question for a while but I haven’t got answer that have actually helped. Im using this code to display a hoverImage and a DIV (which is my drop down menu)

[CODE]function showDrop(id,imgName,hoverImg) {
document.getElementById(id).style.display=”block”;
document.images[imgName].src=hoverImg;
}[/CODE]

Heres a link to the website Im making…

[URL=http://www.spaodesigns.com/www/Coast/index.html]Click Here[/URL]

If you scroll over the “About” button you’ll notice the button image changes to an image with a darker colored “About” and also the drop down menu appears. How can I make it so that when the user moves their mouse down to the drop down menu the “About” hover image stays the same. And also how do I write an onMouseout function to tell the “About” button to return to the normal UpState and to make the drop down go away.

to post a comment
JavaScript

8 Comments(s)

Copy linkTweet thisAlerts:
@intriviousAug 27.2006 — You could add an onmouseover for the <div> that contains "example link one...." In that onmouseover do the same thing you did in showDrop()
Copy linkTweet thisAlerts:
@IliketheWebauthorAug 27.2006 — Could you give me an example?
Copy linkTweet thisAlerts:
@intriviousAug 27.2006 — In your dropdownmenu() function, maybe add something like this:

[CODE]
function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)

dropmenuobj.onmouseover = "MM_swapImage('about','','images/layout/buttons/about_over.gif',1);";
dropmenuobj.onmouseout = "MM_swapImgRestore();";

...

}
[/CODE]


This is a pretty big stab at it, but maybe something of that affect.
Copy linkTweet thisAlerts:
@Rossario123Aug 27.2006 — is this sort of what you mean?

<i>
</i>&lt;script type="text/javascript"&gt;
function changeImageBack()
{
document.images["jsbutton"].src = "image url off state";
return true;
}
&lt;/script&gt;


[code=html]

<a href="#" onMouseOut= "return changeImageBack()" ><img
name="jsbutton" src="#"/></a>
Copy linkTweet thisAlerts:
@IliketheWebauthorAug 27.2006 — I think I may have figured it out, look at this...

Here are the javascript functions im using

[CODE]function showDrop(id,imgName,hoverImg) {
document.getElementById(id).style.display="block";
document.images[imgName].src=hoverImg;
}
function hideDrop(id,imgName,Img) {
document.getElementById(id).style.display="none";
document.images[imgName].src=Img;
}[/CODE]


Heres the code on the actual "About" button

[CODE]<a href="#" onmouseover="showDrop('aboutDrop','aboutBtn','images/layout/buttons/about_over.gif')" onmouseout="hideDrop('aboutDrop','aboutBtn','images/layout/buttons/about.gif')"><img src="images/layout/buttons/about.gif" name="aboutBtn" width="70" height="26" border="0" id="aboutBtn" /></a>[/CODE]

And heres the code I put on the DIV

[CODE]<div id="aboutDrop" style="display:none" onmouseover="showDrop('aboutDrop','aboutBtn','images/layout/buttons/about_over.gif')" onmouseout="hideDrop('aboutDrop','aboutBtn','images/layout/buttons/about.gif')"></div>[/CODE]
Copy linkTweet thisAlerts:
@Rossario123Aug 27.2006 — is this sort of what you mean?

<i>
</i>&lt;script type="text/javascript"&gt;
function changeImageBack()
{
document.images["jsbutton"].src = "image url off state";
return true;
}
&lt;/script&gt;


[code=html]
<a href="#" onMouseOut= "return changeImageBack()" ><img
name="jsbutton" src="#"/></a>
[/code]


i appologize for the above post
Copy linkTweet thisAlerts:
@intriviousAug 27.2006 — is this sort of what you mean?[/QUOTE]

Just for future reference, you can edit your previous posts.

So does that work for you 'iliketheweb'?
Copy linkTweet thisAlerts:
@IliketheWebauthorAug 27.2006 — thankyou for your help everyone I got it working
×

Success!

Help @IliketheWeb 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.19,
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,
)...