473,320 Members | 2,048 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

click() function does not have same effect as real click (IE 6)

I'm trying to implement a dynamic menu using CSS/DHTML/JavaScript. The
menu bar is implemented as hyperlinks so I can use the :hover :active
etc. pseudo-styles.

When moving from one item to another on the menu bar I want to
simulate the user clicking on the menu bar item they've just moved
onto, so the adjacent menu drops down automatically.

So I have something like this:

function MenuBarItemMouseover(menuBarItem)
{
menuBarItem.click();
}

to simulate the user clicking on the adjacent menu.

However it seems the previous menu bar item stays in the 'active'
state and the item that has been moved onto remains in the 'hover'
state.

The css styles are defined in the order: link, visited, hover, active,
and in any case, it works fine if you actually do a mouse click on a
different menu bar item. It seems the programmatic click is not the
same.

Is there anyway of forcing the previous link to 'normal' and the new
link to 'active' using JavaScript? Or is there some other way of
simulating a mouse click?
Jul 23 '05 #1
1 1672

It turns out the answer is very simple. ¡Hurrah!

You need to call focus() on the item that you wish to click, since
click() itself does not change the focus (on IE 6), and hence the
active status of the 2nd item doesn't change:

function MenuBarItemMouseover(menuBarItem)
{
menuBarItem.focus();
menuBarItem.click();
}

On 14 May 2004 11:00:10 -0700, sp********@yahoo.co.uk (Lazlo Woodbine)
wrote:
I'm trying to implement a dynamic menu using CSS/DHTML/JavaScript. The
menu bar is implemented as hyperlinks so I can use the :hover :active
etc. pseudo-styles.

When moving from one item to another on the menu bar I want to
simulate the user clicking on the menu bar item they've just moved
onto, so the adjacent menu drops down automatically.

So I have something like this:

function MenuBarItemMouseover(menuBarItem)
{
menuBarItem.click();
}

to simulate the user clicking on the adjacent menu.

However it seems the previous menu bar item stays in the 'active'
state and the item that has been moved onto remains in the 'hover'
state.

The css styles are defined in the order: link, visited, hover, active,
and in any case, it works fine if you actually do a mouse click on a
different menu bar item. It seems the programmatic click is not the
same.

Is there anyway of forcing the previous link to 'normal' and the new
link to 'active' using JavaScript? Or is there some other way of
simulating a mouse click?


Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Penn Markham | last post by:
Hello all, I am writing a script where I need to use the system() function to call htpasswd. I can do this just fine on the command line...works great (see attached file, test.php). When my...
12
by: Gaurav Veda | last post by:
Hi ! I am a poor mortal who has become terrified of Python. It seems to have thrown all the OO concepts out of the window. Penniless, I ask a basic question : What is the difference between a...
11
by: CW | last post by:
I have message entry screen that's causing me a bit of an issue. At the moment, there are 2 buttons, one is used to send message to another user (btnSend) and another is used to send messages to...
17
by: I.M. !Knuth | last post by:
Hi. I'm more-or-less a C newbie. I thought I had pointers under control until I started goofing around with this: ...
3
by: Beta What | last post by:
Hello, I have a question about casting a function pointer. Say I want to make a generic module (say some ADT implementation) that requires a function pointer from the 'actual/other modules'...
17
by: DanielJohnson | last post by:
how to use the combination function in python ? For example 9 choose 2 (written as 9C2) = 9!/7!*2!=36 Please help, I couldnt find the function through help.
8
by: Deft.Jab | last post by:
This problem only exists in IE, due to UI restrictions I'm using a href in an error label to bring up a modal popup. I'm using a callback to filter a grid on the popup. The problem: The href...
7
by: chambers.anya | last post by:
Hi, I've just been scouring the web trying to find an answer for how to do this but so far without any success. Basically I want some of the links in my page to open in new tabs (I'm using...
1
by: \Ji Zhou [MSFT]\ | last post by:
Hello Jason, Thanks for using Microsoft Newsgroup Support Service, my name is Ji Zhou and I will be working on this issue with you. I have tried to but cannot reproduce your issue on my side....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.