By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,705 Members | 2,017 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,705 IT Pros & Developers. It's quick & easy.

Force fake onmouseover

P: n/a
I have been writing a practice sliding div navigation script. I am finding
myself in the position where I need to force a div into showing the hover
behavior defined in css.

So my question is this. If I have two divs, is there a way to make the
second div display its onmouseover behavior when the mouse is over div 1?
Jul 23 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
news.west.cox.net wrote:
I have been writing a practice sliding div navigation script. I am finding
myself in the position where I need to force a div into showing the hover
behavior defined in css.

So my question is this. If I have two divs, is there a way to make the
second div display its onmouseover behavior when the mouse is over div 1?

onload=function(){ div1.onmouseover=function(){//do stuff with div2}}

or <a... onmouseover="afunction();anotherfunction();">

Mick
Jul 23 '05 #2

P: n/a

"Mick White" <mw***********@rochester.rr.com> wrote in message
news:uq****************@twister.nyroc.rr.com...
news.west.cox.net wrote:
I have been writing a practice sliding div navigation script. I am
finding myself in the position where I need to force a div into showing
the hover behavior defined in css.

So my question is this. If I have two divs, is there a way to make the
second div display its onmouseover behavior when the mouse is over div 1?

onload=function(){ div1.onmouseover=function(){//do stuff with div2}}

or <a... onmouseover="afunction();anotherfunction();">

Mick


I understand what you are saying here. But, it is not what I am looking
for. Let me try to explain better.

The navigation that I have written uses divs that slide into view when you
do a rollover on the main navigation bar. So, say someone rolled over the
first menu item, a div would roll out that shows some sub menu items for
that main menu item. The div stays visible until you rollout from the main
menu item or the sub menu. That all works great.

I have normal css applied to the main menu, so when you roll over an item
and the sub menu div rolls out, the link appearance changes because there is
"hover" behavior defined in my css file. When I move my cursor onto the sub
menu div, the "hover" behavior on the main menu item ceases. That is
because I am no longer hovering over it.

What I am looking for is a script to use for the onmouseover event for the
sliding div. So, when someone is hovering over the div, the main menu item
displays the hover state as defined by css.

Does any of this make sense??? I will try to put together a working example.

Ideally, I would be able to define a var that was say

----- pseudo code - not tested -----
var sm = document.getElementByID("SubMenuItem");
var mm = document.getElementByID("MainMenuItem");
if (sm.onmouseover == true) {
mm.onmouseover = true;
}

So that I could get the "hover" state to appear for MainMenuItem while the
mouse is over SubMenuItem.

Thanks

Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.