473,624 Members | 2,298 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 MenuBarItemMous eover(menuBarIt em)
{
menuBarItem.cli ck();
}

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 1693

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 MenuBarItemMous eover(menuBarIt em)
{
menuBarItem.foc us();
menuBarItem.cli ck();
}

On 14 May 2004 11:00:10 -0700, sp********@yaho o.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 MenuBarItemMous eover(menuBarIt em)
{
menuBarItem.cli ck();
}

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
4947
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 webserver runs that part of the script (see attached file, snippet.php), though, it doesn't go through. I don't get an error message or anything...it just returns a "1" (whereas it should return a "0") as far as I can tell. I have read the PHP...
12
10023
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 class and a function in Python ??? Consider the following code fragments : # Fragment 1 begins a = 1
11
13912
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 all users (btnSendAll). When user hits enter, I also simulate the effect of clicking button (btnSend). However, what I found btnSend doesn't fire (unless I click on the button). The postback function I call is as follows: function...
17
3240
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: ================================================================================ /* A function that returns a pointer-of-arrays to the calling function. */ #include <stdio.h> int *pfunc(void);
3
3641
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' that takes arguments of type (void *) because the ADT must be able to deal with any type of data. In my actual code, I will code the function to take arguments of their real types, then when I pass this pointer through an interface function, I...
17
8085
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
6944
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 has javascript:btn.click() basically, which in Firefox causes a postback after it's clicked. IE works fine without posting back, this is suppose to be an instant popup and the postback defeats the whole purpose. Any ideas?
7
17861
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 Firefox) or windows if the user has their options configured that way. And I want my page to remain intact as it involves some AJAX and takes a while to load. But ...and this seems to be a big "but"... I don't want the focus to
1
4288
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. From your codes, I think the logical is, every time the Timer's elapsed event fires, we call the Check_For_Version_Update() function. From the Check_For_Version_Update() function, we judge a condition statement, and determine whether to call...
0
8242
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8681
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8629
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8488
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7170
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5570
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4084
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2611
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1488
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.